-
Notifications
You must be signed in to change notification settings - Fork 668
/
Copy pathcomponent-with-input.vue
75 lines (72 loc) · 1.77 KB
/
component-with-input.vue
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
<template>
<div>
<input type="checkbox" v-model="checkboxVal" />
<input
type="radio"
v-model="radioVal"
id="radioFoo"
value="radioFooResult"
/>
<input
type="radio"
v-model="radioVal"
id="radioBar"
value="radioBarResult"
/>
<input type="text" v-model="textVal" />
<textarea v-model="textareaVal"></textarea>
<select v-model="selectVal">
<option value="selectA"></option>
<option value="selectB"></option>
<option value="selectC"></option>
</select>
<select v-model="multiselectVal" class="multiselect" multiple>
<option value="selectA"></option>
<option value="selectB"></option>
<option value="selectC"></option>
</select>
<select v-model="selectVal" class="with-optgroups">
<optgroup label="Group1">
<option value="selectA"></option>
<option value="selectB"></option>
</optgroup>
<optgroup label="Group2">
<option value="selectC"></option>
</optgroup>
</select>
<label id="label-el"></label>
<span class="checkboxResult" v-if="checkboxVal">checkbox checked</span>
<span class="counter">{{ counter }}</span>
{{ textVal }}
{{ selectVal }}
{{ JSON.stringify(multiselectVal) }}
{{ radioVal }}
<input id="lazy" type="text" v-model.lazy="lazy" />
{{ lazy }}
</div>
</template>
<script>
export default {
name: 'component-with-input',
data() {
return {
lazy: '',
checkboxVal: undefined,
textVal: undefined,
textareaVal: undefined,
radioVal: undefined,
selectVal: undefined,
multiselectVal: [],
counter: 0
}
},
watch: {
checkboxVal() {
this.counter++
},
radioVal() {
this.counter++
}
}
}
</script>