File tree Expand file tree Collapse file tree 2 files changed +50
-4
lines changed Expand file tree Collapse file tree 2 files changed +50
-4
lines changed Original file line number Diff line number Diff line change 47
47
type: Array
48
48
},
49
49
value: {
50
- type: [String , Object ]
50
+ type: [String , Number , Object ]
51
51
}
52
52
},
53
53
data () {
108
108
optionValue () {
109
109
if (typeof this .value === ' object' ) {
110
110
return this .value .value
111
- } else if ( typeof this . value === ' string ' ) {
111
+ } else {
112
112
return this .value
113
113
}
114
114
},
157
157
this .closeOptions ()
158
158
if (typeof this .value === ' object' ) {
159
159
this .$emit (' input' , option)
160
- } else if ( typeof this . value === ' string ' ) {
160
+ } else {
161
161
this .$emit (' input' , option .value )
162
162
}
163
163
}
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
+ <h3 >Object type model</h3 >
3
4
<div class =" flexbox" >
4
5
<div class =" flex-content" >
5
6
<div >
32
33
</table >
33
34
</div >
34
35
</div >
36
+ <h3 >String type model</h3 >
35
37
<div class =" flexbox" >
36
38
<div class =" flex-content" >
37
39
<div >
62
64
</table >
63
65
</div >
64
66
</div >
67
+ <h3 >Number type model</h3 >
68
+ <div class =" flexbox" >
69
+ <div class =" flex-content" >
70
+ <div >
71
+ <button type =" button" @click =" reset3" class =" btn btn-info btn-sm" >reset</button >
72
+ </div >
73
+ <div >
74
+ <button type =" button" @click =" selectOption3" class =" btn btn-info btn-sm" >option select from parent</button >
75
+ </div >
76
+ <div >
77
+ <model-select :options =" options3"
78
+ v-model =" item3"
79
+ placeholder =" select item3" >
80
+ </model-select >
81
+ </div >
82
+ </div >
83
+ <div class =" flex-result" >
84
+ <table class =" ui celled table" >
85
+ <thead >
86
+ <tr >
87
+ <th >value</th >
88
+ </tr >
89
+ </thead >
90
+ <tbody >
91
+ <tr >
92
+ <td >{{item3}}</td >
93
+ </tr >
94
+ </tbody >
95
+ </table >
96
+ </div >
97
+ </div >
65
98
</div >
66
99
</template >
67
100
121
154
{ value: ' 23' , text: ' more a' + ' - ' + ' 8' },
122
155
{ value: ' 24' , text: ' more a' + ' - ' + ' 9' }
123
156
],
124
- item2: ' '
157
+ item2: ' ' ,
158
+ options3: [
159
+ { value: 0 , text: ' aa' + ' - ' + ' 0' },
160
+ { value: 1 , text: ' aa' + ' - ' + ' 1' },
161
+ { value: 2 , text: ' ab' + ' - ' + ' 2' }
162
+ ],
163
+ item3: 0
125
164
}
126
165
},
127
166
methods: {
138
177
selectOption2 () {
139
178
// select option from parent component
140
179
this .item2 = this .options2 [0 ].value
180
+ },
181
+ reset3 () {
182
+ this .item3 = ' '
183
+ },
184
+ selectOption3 () {
185
+ // select option from parent component
186
+ this .item3 = this .options3 [0 ].value
141
187
}
142
188
},
143
189
components: {
You can’t perform that action at this time.
0 commit comments