-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
75 lines (75 loc) · 1.95 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="app">
<h2>{{person.name}} -- {{person.age}}</h2>
<h3>{{person.fav}}</h3>
<div v-text="msg"></div>
<div v-text="person.fav"></div>
<div v-html="htmlStr"></div>
<input type="text" v-model="person.fav">
<button v-on:click="handleClick">click</button>
<button @click="handleClick2">click2</button>
</div>
<div id="app2">
<h2>{{person.name}} -- {{person.age}}</h2>
<h3>{{person.fav}}</h3>
<div v-text="msg"></div>
<div v-text="person.fav"></div>
<div v-html="htmlStr"></div>
<input type="text" v-model="person.fav">
<button @click="handleClick3">click3</button>
</div>
</body>
<script type="module">
import MyVue from "./MyVue.js"
let vm = new MyVue({
el: '#app',
data() {
return {
person: {
name: 'lxc',
age: 18,
fav: 'JS'
},
msg: '可接受的',
htmlStr: '<div>节点</div>'
}
},
method: {
handleClick() {
this.htmlStr='<div>更新</div>'
},
handleClick2() {
this.msg='更新'
this.person.name='更新'
this.person.age='更新'
}
}
})
let vm2 = new MyVue({
el: '#app2',
data() {
return {
person: {
name: 'lxc',
age: 18,
fav: 'JS'
},
msg: '可接受的',
htmlStr: '<div>节点</div>'
}
},
method: {
handleClick3() {
this.htmlStr='<div>更新</div>'
}
}
})
console.log(vm.$data)
</script>
</html>