-
Notifications
You must be signed in to change notification settings - Fork 144
/
21.表单.html
54 lines (50 loc) · 1.44 KB
/
21.表单.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="app" >
//取value值 对应的checkbox 必须是数组 <br>
<input checked type="checkbox" value="点击" v-model="name" name="all">
<input type="checkbox" value="点击1" v-model="name" name="all">
<input type="checkbox" value="点击2" v-model="name" name="all">
{{name}}
<input type="radio" v-model="radio" value="man" name="group">男
<input type="radio" v-model="radio" value="woman" name="group">女
{{radio}}
//取selects的值就是我们对应的当前选中的值
<select v-model="selects">
<option v-for="l in lists" v-bind:value="l.name">{{l.name}}</option>
<!--<option value="1">hello</option>
<option value="2">world</option>
<option value="3">hello world</option>-->
</select>
<!-- <select id="select">
<option value="1">4</option>
<option value="2">3</option>
<option value="3">2</option>
</select>-->
<input type="checkbox" v-model="name">{{name}}
</div>
<script src="vue.js"></script>
<script>
/* select.onchange = function () {
alert(this.value)
}*/
var vm = new Vue({
el:"#app",
data:{
name:[],
selects:'jw2',
lists:[
{name:'jw1'},
{name:'jw2'},
{name:'jw3'}
]
}
})
</script>
</body>
</html>