<!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">
{{ message }} {{name}}
</div>
<script type="text/javascript">
var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!',
name : "Vue"
}
});
</script>
</body>
</html>
//=======================================================
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="vue.js"></script>
</head>
<body>
<div id="root">
{{name}} {{age}}
</div>
<script>
const app = new Vue({
el:'#root',
data:{
name:'wulei',
age:40
}
});
</script>
</body>
</html>
============================================================
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="vue.js"></script>
</head>
<body>
<div id="root">
</div>
<script>
var data = {a:1};
var vm = new Vue({
el:'#root',
data:data
});
vm.a == data.a;
// $watch 监控变量的新值和老值。
vm.$watch('a',function(lv,xv){
console.log(lv,xv);
});
vm.a = "new data";
console.log(vm.a === data.a);
</script>
</body>
</html>