在我的nuxt组件中,我知道我可以使用以下内容来显示来自Font Awesome的图标:<fa icon="circle" />
但是当我在观察器中构建HTML内容时,我需要做什么来使用相同的图标,比如:
watch: {
events(newEvents, _) {
let infoWindowContent = ''
newEvents.forEach((event) => {
infoWindowContent = infoWindowContent.concat(
`<div><fa icon="circle" /> <-- this doesn't work! </div>`
)
}
const infowindow = new window.google.maps.InfoWindow({
content: infoWindowContent,
})
window.google.maps.event.addListener(marker, 'click', () => {
infowindow.open(this.map, marker)
})
}
}
?
1条答案
按热度按时间nc1teljy1#
你不能在
v-html
中使用Vue-Component。使用
而不是
v-html
nuxt 3示例(在ts中使用eslint):
nuxt.config.ts
在组件中