-
Notifications
You must be signed in to change notification settings - Fork 0
/
dd.html
87 lines (82 loc) · 1.57 KB
/
dd.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<!--View-->
<div id="demo">
<input v-model="name" name="{{name}}" /> {{name}}{{skill}}
<!--ng-bind-->
<p v-text="name"></p>
<!--ng-bind-html $sce-->
<!--xss-->
{{{html}}}
{{num>4?'你是真的吧':'你是假的吧'}}
<p v-html="html"></p>
<!--<button v-on:click="Click()">Ok</button>-->
<button @click="Click()">Ok</button>
</div>
<div id="demo2">
{{name}}
<button @click="Click()">Ok</button>
</div>
</body>
<script src="vue.js"></script>
<script>
// function Vue(name){
// this.name = name
// }
//Vue构造器,创建一个对象
//Model
var Click = function() {
console.log(this.name);
}
var data = {
name: 'wsscat',
skill: 'PS',
html: '<p>123</p>',
num: 3
}
var demo = new Vue({
//element的缩写
el: '#demo',
//$scope.name
data: data,
//把函数定义在methods
methods: {
Click: Click,
Wsscat: function() {
console.log("test")
}
},
ready: function() {
this.Click();
}
})
//下面是设置数据数据的所有方法
//demo.name = 'tacssw';
//demo.$data.name = 'tacssw';
//demo.$set('name','tacssw')
data.name = '123'
demo.$get('name')
console.log(demo.$get('name'))
/*demo.$watch('name',function(o,n){
console.log(o+" "+n)
})*/
console.log(demo)
//demo.Click();
//demo.Wsscat();
new Vue({
el: '#demo2',
data: {
name: 'abc',
data: data
},
methods: {
Click: Click
}
})
</script>
</html>