<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Vue自学:V-html指令的用法</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app" v-html = "message">
{{message}}
</div>
</body>
<script type="text/javascript">
//v-html为实例化HTML代码的指令
//v-hmtl需要绑定变量数据,绑定方式为 v-html = “message”
let app = new Vue({
el:’#app’,
data:{
message:’<h3>test</h3>‘
}
})
</script>
</html>