【发布时间】:2019-08-04 03:39:04
【问题描述】:
在
locale/lang.json我有
{
"title": "Title",
"image": "service-corporate_thumb-v2.jpg",
"alt": "alt",
"imageFooter": "Some caption %",
"imageFooterCTA": "author",
"imageFooterURL": "https://example.com/author",
},
我正在尝试像这样生成作者:
<img :src="require(`~/assets/img/services/${service.image}`)" :alt="service.alt" class="mb-8">
<p>{{ service.imageFooter.replace('%', `<a href="${service.imageFooterURL}" target="_blank" class="primary-text">${service.imageFooterCTA}</a>`) }}</p>
但这会在生成的 HTML 中打印出来:
{{ service.imageFooter.replace('%', `${service.imageFooterCTA}`) }}
如何在 {{ 表达式 }} 中生成 html?
【问题讨论】:
标签: html vue.js translation nuxt.js