-
Notifications
You must be signed in to change notification settings - Fork 0
/
mvvm.html
53 lines (45 loc) · 1.2 KB
/
mvvm.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>MVVM</title>
<style>
</style>
</head>
<body>
<div id="rrc-app" style="margin: 200px auto; width: 400px;">
{{str}}
<input type="text" v-bind:value="child.someStr">
<p>{{str}}</p>
<button v-on:click="clickBtn">点击改变child</button>
</div>
<!-- <script src="http://cdn.bootcss.com/vue/1.0.25/vue.js"></script> -->
<script src="./obsever.js"></script>
<script src="./watcher.js"></script>
<script src="./compile.js"></script>
<script src="./mvvm.js"></script>
<script>
var vm = new MVVM({
el: '#rrc-app',
data: {
str: 'hello ',
child: {
someStr: 'World !'
}
},
computed: {
// getHelloWord: function () {
// return this.str + this.child.someStr;
// }
},
methods: {
clickBtn: function (e) {
this.child = {
someStr: 'RRC'
}
}
}
});
</script>
</body>
</html>