-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vue.js实战第六章笔记.html
96 lines (88 loc) · 2.77 KB
/
Vue.js实战第六章笔记.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
88
89
90
91
92
93
94
95
96
<html>
<head>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<title>vuejs实战第六章</title>
</head>
<body>
//text
<div id="app1">
<input v-model='num'/>
<div>
输入的内容是:{{num}}
</div>
</div>
//radioButton
<div id="app2">
<input type="radio" v-model="radioChecked" value="苹果">苹果
<input type="radio" v-model="radioChecked" value="小米">小米
<input type="radio" v-model="radioChecked" value="三星">三星
<div>选中的状态为: {{ radioChecked }}</div>
</div>
//checkbox
<div id="app3">
<input type="checkbox" v-model="checkboxChecked" value="苹果">苹果
<input type="checkbox" v-model="checkboxChecked" value="小米">小米
<input type="checkbox" v-model="checkboxChecked" value="三星">三星
<div>选中的状态为: {{ checkboxChecked }}</div>
</div>
//下拉框
<div id="app4">
<select name="" id="" v-model="selected">
<!-- <select name="" id="" v-model="selected" multiple> -->
<option value="苹果">苹果</option>
<option value="三星">三星</option>
<option value="小米">小米</option>
</select>
<div>{{selected}}</div>
</div>
//循环输入输出下拉框
<div id="app5">
<select name="" id="" v-model="selected">
<option v-for="option in options" :value="option.value">{{option.text}}</option>
</select>
<div>{{selected}}</div>
</div>
</body>
<script>
let app1 = new Vue({
el: '#app1',
data: {
num:1
}
})
let app2 = new Vue({
el: '#app2',
data: {
radioChecked: '小米'
}
})
let app3 = new Vue({
el: '#app3',
data: {
checkboxChecked: ['苹果']
}
})
let app4 = new Vue({
el: '#app4',
data: {
selected: '苹果'
}
})
let app5 = new Vue({
el: '#app5',
data: {
selected: '小米',
options:[{
text: '小米',
value: '小米'
},{
text: '三星',
value: '三星'
},{
text: '苹果',
value: '苹果'
}]
}
})
</script>
</html>