Vue v-html
<!DOCTYPE html><html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="app">
<h1>{{msg}}</h1>
<p>--------------------</p>
<div v-html="site"></div>
<div v-html="intro"></div>
</div>
<script src="js/vue.3.2.2.js"></script>
<script>
// 1、创建Vue的实例对象
const app = Vue.createApp({
data(){//定义数据
return {
msg:'你好!',
site:'<a href="http://www.baidu.com">baidu</a>',
intro:'<button>button</button>'
}
}
}).mount('#app');
</script>
</body>
</html>
以上是 Vue v-html 的全部内容, 来源链接: utcz.com/z/380628.html