【发布时间】:2020-11-10 14:37:45
【问题描述】:
您好,我从 VueJS 开始,但我遇到了一个问题,如何将我的模板中的 IMG src 与我的文件 JSON 中写入的 URL 连接起来。例如,当我有一些产品并且我想为我需要的每篇文章显示完整的徽标时将文件 JSON 中存在的 URL 添加到 src IMG 中。我该怎么做,谢谢
<img src="info.imglogo" alt="Media Aside" />
<span v-text="info.logotitle"></span>
</template>
var infos = [
{
compteur: 1,
imglogo: "../imgs/theme.jpg",
logotitle: "Themeforest",
title: "Thrive Themes",
description:
"Conversion Focused WordPress Themes & Plugins, built from the ground up to make your entire website convert more of your visitors into subscribers, customers & clients.",
link1: "Visit ThriveTheme",
link2: "Read Review",
url: "../imgs/theme.jpg"
},
{
compteur: 2,
logotitle: "Elegant",
title: "Sub-Ex",
description: "com.goodreads.Tres-Zap",
link1: "Dr",
link2: "Honorable",
url: "../imgs/theme.jpg"
},
];
export default {
data() {
return {
infos: infos
};
},
name: "Home",
components: {}
};
</script>
【问题讨论】:
-
我强烈推荐你使用像codesandbox.io这样的工具