forked from vuejs/test-utils
/
ComponentWithInput.vue
78 lines (73 loc) · 1.82 KB
/
ComponentWithInput.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
76
77
78
<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" />
<input id="lazy" type="text" v-model.lazy="lazy" />
<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="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>
<select v-model="multiselectVal" class="multiselect" multiple>
<option value="selectA"></option>
<option value="selectB"></option>
<option value="selectC"></option>
</select>
<label id="label-el"></label>
<span class="checkboxResult" v-if="checkboxVal">checkbox checked</span>
<span class="counter">{{ counter }}</span>
{{ textVal }}
{{ selectVal }}
{{ multiselectVal }}
{{ radioVal }}
{{ lazy }}
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
name: 'ComponentWithInput',
data() {
return {
checkboxVal: undefined,
textVal: undefined,
lazy: undefined,
textareaVal: undefined,
radioVal: undefined,
selectVal: undefined,
multiselectVal: [],
counter: 0
}
},
watch: {
checkboxVal() {
this.counter++
},
radioVal() {
this.counter++
}
}
})
</script>