forked from vuejs/vue-test-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponent-with-input.vue
53 lines (50 loc) · 1.33 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
<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">
<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>
<label id="label-el"></label>
<span class="checkboxResult" v-if="checkboxVal">checkbox checked</span>
<span class="counter">{{ counter }}</span>
{{ textVal }}
{{ selectVal }}
{{ radioVal }}
</div>
</template>
<script>
export default {
name: 'component-with-input',
data () {
return {
checkboxVal: undefined,
textVal: undefined,
radioVal: undefined,
selectVal: undefined,
counter: 0
}
},
watch: {
checkboxVal () {
this.counter++
},
radioVal () {
this.counter++
}
}
}
</script>