v-img
v-img copied to clipboard
v-img not showing image when applying with group on non img element
v-img works fine with img tag. But I have requirement to integrate it with font awesome icon so i use v-img="{src:fileslocation,group:groupname
}" but it doesn't show image than i remove group from object and it works.
Please solve this bug i have to use group.
Sad we won't ever get this fixed. however I think I've found the issue, if you look into lib/index.js
on lines 128-130 you'll see that he's only querying for img elements and nothing else:
images = [
...document.querySelectorAll(`img[data-vue-img-group="${el.dataset.vueImgGroup}"]`),
];
I could open a PR to fix this or maybe fork it?
for anyone who facing this issue, you can fix this with:
in lib/index.js
and in .vue / html file, you should add v-img
class, so the package can find which element to read, for example:
<span class="v-img" v-img="{ src: '...', group: 11 }">
<i ...></i>
</span>
or
<img v-img class="v-img" src="...">
or you can use this https://www.npmjs.com/package/v-img-viewer, I've fixed the issue there, 'cause this repo is no longer maintained by the owner