vue的起步和插值:
1、历史介绍
vue2014年,用户体验好
作者:尤雨溪
2、实例训练:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>vue的起步和插值</title>
</head>
<body>
<div id="app">
<h2>{{ msg }}</h2>
<h2>{{ 2 }}</h2>
<h2>{{ "hello" }}</h2>
<h3>{{ 1>2?'真的':'假的' }}</h3>
<h1>{{getContent()}}</h1>
</div>
<script src="vue.js"></script>
<script>
const vm = new Vue({
el: '#app',
data: {
msg:'hello vue',
msg2:'content'
},
methods: {
getContent(){
return this.msg + ' ' + this.msg2;
}
}
})
console.log(vm);
</script>
</body>
</html>
3、代码结果: