-
Notifications
You must be signed in to change notification settings - Fork 476
/
Copy path01 is.html
101 lines (96 loc) · 2.99 KB
/
01 is.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
97
98
99
100
101
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="vue.js"></script>
<meta charset="UTF-8">
<title>01</title>
</head>
<body>
<pre>
自定义的元素,使用 is 的特性(form 元素,使用 is 示例)
</pre>
<div id="app1">
<hr>
<table border='1'>
<tr is="my-component1"></tr>
<tr is="my-component2"></tr>
</table>
<hr>
<input is="input1" v-model="input1">{{input1}}
<hr>
<textarea is="textarea1" v-model="textarea1"></textarea>{{textarea1}}
<hr>
<input is="checkbox_bike" v-model="checkbox_bike">{{checkbox_bike}}
<input is="checkbox_car" v-model="checkbox_car">{{checkbox_car}}
<hr> 男性:
<input type="radio" is="radio_sex1" v-model="radio1"/>
<br /> 女性:
<input type="radio" is="radio_sex2" v-model='radio1'/>
{{radio1}}
<hr>
<select is="select1" v-model="select1"></select>
{{select1}}
</div>
<script>
var select1 =Vue.extend({
template:'<select ><option selected>A</option><option>B</option><option>C</option></select>'
});
var radio_sex1 = Vue.extend({
template:'<input type="radio" checked="checked" name="Sex" value="male" />'
});
var radio_sex2=Vue.extend({
template:'<input type="radio" name="Sex" value="female" />'
});
var checkbox_bike = Vue.extend({
template: '<input type="checkbox" name="Bike">'
});
var checkbox_car = Vue.extend({
template: '<input type="checkbox" name="Car">'
});
var textarea1 = Vue.extend({
template: '<textarea rows="10" cols="30">台湾小凡使用 textarea</textarea>'
});
var input1 = Vue.extend({
template: '<input type="text" value="台湾小凡使用 textbox" id="input1" name="input1" >'
});
var tr1 = Vue.extend({
template: '<tr><td>项目1</td><td>{{a}}</td></tr>',
data: function() {
return {
a: '学 vue ,还蛮开心的~'
}
}
});
var tr2 = Vue.extend({
template: '<tr><td>项目2</td><td>{{a}}</td></tr>',
data: function() {
return {
a: '每一个示例,都有价值'
}
}
});
var vm = new Vue({
el: '#app1',
components: {
'my-component1': tr1,
'my-component2': tr2,
'input1': input1,
'textarea1': textarea1,
'checkbox_bike': checkbox_bike,
'checkbox_car': checkbox_car,
'radio_sex1':radio_sex1,
'radio_sex2':radio_sex2,
'select1':select1
},
data: {
'input1': '',
'textarea1': '',
'checkbox_bike':'',
'checkbox_car':'',
'radio1':'',
'select1':''
}
});
</script>
</body>
</html>