v-html的使用
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="app" v-html="url"></div>
<h1 id="htext" v-text="url"></h1>
<p id="ptext" v-pre>{{val}}</p>
<script src="../vue.js"></script>
<script>
const app = new Vue({
el: '#app',
data: {
url: "<a href='http://www.baidu.com'>百度一下</a>"
}
})
const app1 = new Vue({
el: '#htext',
data: {
url: "<a href='http://www.baidu.com'>百度一下</a>"
}
})
const app2 = new Vue({
el: '#ptext',
data: {
val: "hhhh"
}
})
</script>
</body>
</html>