我想动态创建3张卡.每张卡片都有一个图像,我想为每一张卡片动态设置一条路径,但我不能使用代字号~
,因为代字号不会转换为绝对路径:
<img
:src="'~/assets/images/how-to-use/image1.jpg'"
:alt="part.title"
/>
我收到了这个错误:
GET http://localhost:3000/~/assets/images/how-to-use/image2.jpg 404 (Page not found: /~/assets/images/how-to-use/image1.jpg)
我把我的buildAssetsDir
设置为example
,但我甚至不能这么做:
<img
:src="'example/assets/images/how-to-use/image1.jpg'"
:alt="part.title"
/>
此代码在构建时间过后将不起作用.但是为什么呢?