<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>maby 的 第一个Vue.js</title>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
<p>{{message}}</p>
</div>
<script>
new Vue({
el:'#app',
data:{
message:'maby 的 第一个Vue.js'
}
})
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
</head>
<body>
<div id="vue_dat">
<h1 style="color: red">name:{{name}}</h1>
<h2 style="color: brown">age:{{age}}</h2>
<h3 style="color: yellow">salary:{{salary}}</h3>
<h4 style="color: greenyellow">{{details()}}</h4>
</div>
<script type="text/javascript">
var vm = new Vue({
el:'#vue_dat',
data:{
name:"mabingyang",
age:"23",
salary:"20000"
},
methods:{
details:function () {
return this.name + "is 马炳阳"
}
}
})
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
</head>
<body>
<div id="vue_det">
<h1 style="color: greenyellow">name:{{name}}</h1>
<h2 style="color: green">age:{{age}}</h2>
<h3 style="color: red">salary:{{salary}}</h3>
</div>
<script type="text/javascript">
var data = {name:"mabingyang",age:"23",salary:20000}
var vm = new Vue({
el:"#vue_det",
data:data
})
document.write(vm.name == data.name)
document.write("<br>")
vm.name = "马炳阳"
document.write(data.name)
document.write("<br>")
data.salary = 30000
document.write(vm.salary)
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
</head>
<body>
<div id="vue_det">
<h3 style="color: red">{{name}}</h3>
<h3 style="color: green">{{age}}</h3>
<h3 style="color: greenyellow">{{salary}}</h3>
</div>
<script type="text/javascript">
var data = {name:"mabingyang",age:23,salary:10000}
var vm = new Vue({
el:"#vue_det",
data:data
})
document.writeln(vm.$el === document.getElementById("vue_det"))
document.write("<br>")
document.write(vm.$data === data)
</script>
</body>
</html>