0

所以我想从数据选项中显示一些文本和图像。使用 v-for,我可以显示名称但不能显示图像(我尝试了一个普通的 img 标签,其中包含来自其中一个对象的硬编码 src,它工作得很好)。

    <div class="p-p-6">
        <div v-for="therapy in therapies" :key="therapy.id">
            <p>{{ therapy.name }}</p>
            <img :src="therapy.url" alt="">
        </div>
    </div>
</template>
<script>
export default {
    name: "Detaljno",
    data() {
        return {
            therapies: [
                {
                    id: 1,
                    name: "Bowen terapija",
                    url: "@/assets/images/bowen1.jpeg",
                    description: "",
                },
                {
                    id: 2,
                    name: "Emmet terapija",
                    url: "@/assets/images/bowen1.jpeg",
                    description: "",
                },
                {
                    id: 1,
                    name: "Mirror terapija",
                    url: "@/assets/images/bowen1.jpeg",
                    description: "",
                },
            ],
        };
    },
};
</script>
<style scoped lang="scss">

</style>

有什么解决办法吗?

4

0 回答 0