vue.js输出HTML(v-pre | v-html)
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport"content="width=device-
·
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<!-- Vue.js -->
<script src="https://unpkg.com/vue/dist/vue.min.js"></script>
</head>
<body>
<div id="app">
<!--# 如果想显示{{ }}标签,而不进行替换,使用v-pre即可调过这个元素和它的子元素的编译过程 #-->
<span v-pre>{{ 这里的内容不会被编译 }}</span>
<span v-html="link"></span>
</div>
</body>
</html>
<script>
var myData = {
link:'<a href="#">这是一个连接</a>'
};
var app = new Vue({
el:'#app',
data:myData
})
</script>
更多推荐
已为社区贡献5条内容
所有评论(0)