更新元素的 innerHTML。
注意:内容按普通 HTML 插入 - 不会作为 Vue 模板进行编译。
<template>
<div class="hello">
<span v-html="aHtml"></span>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
data () {
return {
aHtml: "<a href='https://www.baidu.com'>张三丰</a>"
}
},
methods: {
},
async created () {
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
