我正在使用v-for使用Vuetify v-img显示图像集合。我们只存储图像的Id,然后将其动态插入v-img的src属性中。但是动态插入src值是不起作用的。显示image.title,但不显示v-img的任何内容。我已经尝试了几个其他的答案,但没有一个有效。有谁知道做这件事的正确方法是什么?
<v-card max-width="400" v-for="image in images" :key="image.sourceId">
{{image.title}}
<v-img
src="'https://img.imagestore.com/image/' + image.sourceId + '.jpg'">
</v-img>
</v-card>
export default {
data: () => ({
images: [
{
id: "2",
sourceId: "bMwG1R3sXnE",
title: "Sunrise"
},
{
id: "3",
sourceId: "pqrwG1R3sXnE",
title: "Amazon Forest"
}
]
}) 发布于 2020-03-04 15:35:19
绑定src属性使其正常工作,因此使用:src代替src
<v-img
:src="'https://img.imagestore.com/image/' + image.sourceId + '.jpg'">
</v-img>或
<v-img
:src="`https://img.imagestore.com/image/${image.sourceId}.jpg`">
</v-img>https://stackoverflow.com/questions/60520490
复制相似问题