更新时间:2023-11-13 19:42:58
可以尝试在ChildComponent中make方法:
You can try to make method in ChildComponent:
getUrl (img) { return require(`~/assets/icons/${img}.png`); }
然后在模板中:
<img :src="getUrl(imageAddress)" alt="" />
为什么在 NuxtJS 中作为 prop 传递时,require() 没有解析图像路径?