Why Image Path Is Not Resolved By Require() When Passed As Prop In Nuxtjs?
In my NuxtJS project I have a component that recieves an image path as a prop. I tried passing it directly to :src='imageAddress' but it neither resolve nor throws an error. Then I
Solution 1:
You can try to make method in ChildComponent:
getUrl (img) {
returnrequire(`~/assets/icons/${img}.png`);
}
then in template:
<img:src="getUrl(imageAddress)"alt="" />
Post a Comment for "Why Image Path Is Not Resolved By Require() When Passed As Prop In Nuxtjs?"