Commit fe44201b46fd4d25007152ac884926a0ec64ae84
1 parent
d31b0d47
DatePicker add clearable prop
DatePicker add clearable prop
Showing
2 changed files
with
6 additions
and
1 deletions
Show diff stats
src/components/date-picker/picker.vue
@@ -158,6 +158,10 @@ | @@ -158,6 +158,10 @@ | ||
158 | type: Boolean, | 158 | type: Boolean, |
159 | default: true | 159 | default: true |
160 | }, | 160 | }, |
161 | + clearable: { | ||
162 | + type: Boolean, | ||
163 | + default: true | ||
164 | + }, | ||
161 | size: { | 165 | size: { |
162 | validator (value) { | 166 | validator (value) { |
163 | return oneOf(value, ['small', 'large']); | 167 | return oneOf(value, ['small', 'large']); |
@@ -302,7 +306,7 @@ | @@ -302,7 +306,7 @@ | ||
302 | }, | 306 | }, |
303 | handleInputMouseenter () { | 307 | handleInputMouseenter () { |
304 | if (this.readonly || this.disabled) return; | 308 | if (this.readonly || this.disabled) return; |
305 | - if (this.visualValue) { | 309 | + if (this.visualValue && this.clearable) { |
306 | this.showClose = true; | 310 | this.showClose = true; |
307 | } | 311 | } |
308 | }, | 312 | }, |
test/routers/date.vue
@@ -24,6 +24,7 @@ | @@ -24,6 +24,7 @@ | ||
24 | :editable="true" | 24 | :editable="true" |
25 | :format="format" | 25 | :format="format" |
26 | @on-change="change" | 26 | @on-change="change" |
27 | + :clearable="false" | ||
27 | :options="options2"></date-picker> | 28 | :options="options2"></date-picker> |
28 | </i-col> | 29 | </i-col> |
29 | </row> | 30 | </row> |