此贴为【vue.js教程】第5节 模板语法-插值讨论区,可以在这里分享经验、交流问题。
DCloud
- 发布:2019-08-23 11:03
- 更新:2020-07-13 23:11
- 阅读:4476
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>插值</title>
<script src="vue.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="app">
<p v-once>{{msg}}</p>
<p>Using mustaches: {{rawHtml}}</p>
<p v-html="rawHtml"></p>
<div v-bind:class="color">test...</div>
<p>{{number + 1}}</p>
<p>{{ 1 == 1 ? 'yes' : 'no'}}</p>
<p>{{message.split('').reverse().join('')}}</p>
</div>
<script type="text/javascript">
var vm = new Vue({
el: '#app',
data: {
msg: 'hi vue',
rawHtml: '<span style="color:red">this is should be red</span>',
color: 'blue',
number: 10,
ok: false,
message: 'vue'
}
})
vm.msg = 'hi...'
console.log(vm.msg);
</script>
<style type="text/css">
.red{color:red;}
.blue{color: blue; font-size: 60px;}
</style>
</body>
</html>
baby325
有免费看不错了,挑剔别看
2020-10-23 15:59
海绵猿宝
小子真浮躁
2021-11-12 15:38