Commit d31b08019914da5209e802e4b6c6aa941385d32a
1 parent
63e0444e
fixed DatePicker bug
edit date when Do Not use options props
Showing
2 changed files
with
11 additions
and
26 deletions
Show diff stats
src/components/date-picker/picker.vue
| @@ -295,8 +295,8 @@ | @@ -295,8 +295,8 @@ | ||
| 295 | const parsedDate = parseDate(value, format); | 295 | const parsedDate = parseDate(value, format); |
| 296 | 296 | ||
| 297 | if (parsedDate instanceof Date) { | 297 | if (parsedDate instanceof Date) { |
| 298 | - const options = this.options; | ||
| 299 | - if (options.disabledDate && typeof options.disabledDate === 'function' && options.disabledDate(new Date(parsedDate))) { | 298 | + const options = this.options || false; |
| 299 | + if (options && options.disabledDate && typeof options.disabledDate === 'function' && options.disabledDate(new Date(parsedDate))) { | ||
| 300 | correctValue = oldValue; | 300 | correctValue = oldValue; |
| 301 | } else { | 301 | } else { |
| 302 | correctValue = formatDate(parsedDate, format); | 302 | correctValue = formatDate(parsedDate, format); |
test/routers/date.vue
| 1 | <template> | 1 | <template> |
| 2 | - <date-picker :open="true" type="date" placeholder="选择日期" style="width: 200px"><span></span></date-picker> | 2 | + <row> |
| 3 | + <i-col span="12"> | ||
| 4 | + <date-picker type="date" placeholder="选择日期" style="width: 200px"></date-picker> | ||
| 5 | + </i-col> | ||
| 6 | + <i-col span="12"> | ||
| 7 | + <date-picker type="daterange" placement="bottom-end" placeholder="选择日期" style="width: 200px"></date-picker> | ||
| 8 | + </i-col> | ||
| 9 | + </row> | ||
| 3 | </template> | 10 | </template> |
| 4 | <script> | 11 | <script> |
| 5 | export default { | 12 | export default { |
| 6 | - data () { | ||
| 7 | - return { | ||
| 8 | - open: false, | ||
| 9 | - value3: '' | ||
| 10 | - } | ||
| 11 | - }, | ||
| 12 | - methods: { | ||
| 13 | - handleClick () { | ||
| 14 | - this.open = !this.open; | ||
| 15 | - }, | ||
| 16 | - handleChange (date) { | ||
| 17 | - this.value3 = date; | ||
| 18 | - }, | ||
| 19 | - c (s) { | ||
| 20 | - console.log(s) | ||
| 21 | - }, | ||
| 22 | - clear (s) { | ||
| 23 | - console.log(s) | ||
| 24 | - }, | ||
| 25 | - ok (s) { | ||
| 26 | - console.log(s) | ||
| 27 | - } | ||
| 28 | - } | 13 | + |
| 29 | } | 14 | } |
| 30 | </script> | 15 | </script> |