Time-Traveler

时光旅人,向往美好

0%

vue6:常用特性

1.表单操作

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
<div id="app">
<form action="http://itcast.cn">
<div>
<span>姓名:</span>
<span>
<input type="text" v-model='uname'>
</span>
</div>
<div>
<span>性别:</span>
<span>
<input type="radio" id="male" value="1" v-model='gender'>
<label for="male"></label>
<input type="radio" id="female" value="2" v-model='gender'>
<label for="female"></label>
</span>
</div>
<div>
<span>爱好:</span>
<input type="checkbox" id="ball" value="1" v-model='hobby'>
<label for="ball">篮球</label>
<input type="checkbox" id="sing" value="2" v-model='hobby'>
<label for="sing">唱歌</label>
<input type="checkbox" id="code" value="3" v-model='hobby'>
<label for="code">写代码</label>
</div>
<div>
<span>职业:</span>
<select v-model='occupation' >
<option value="0">请选择职业...</option>
<option value="1">教师</option>
<option value="2">软件工程师</option>
<option value="3">律师</option>
</select>
</div>
<div>
<span>个人简介:</span>
<textarea v-model='desc'></textarea>
</div>
<div>
<!--注意要使用js的方式来提交-->
<input type="submit" value="提交" @click.prevent='handle'>
</div>
</form>
</div>
</body>
<script>
let app = new Vue({
el: '#app',
data: {
uname: 'Jamie',
gender: 1,
hobby: ['1','2'],
occupation: 1,
desc: 'Jamie is a softwareEngineer!',
},
method:{
}
})
</script>