DatePicker: add onPick option, close #2921 (#3681)

* DatePicker: add onPick option, close #2921

* DatePicker: fix typo
pull/3720/head
cinwell.li 2017-03-24 15:32:34 +08:00 committed by baiyaaaaa
parent 8359db6d25
commit 8f9b473911
3 changed files with 3 additions and 1 deletions

View File

@ -269,6 +269,7 @@ Picking a date range is supported.
| shortcuts | a { text, onClick } object array to set shortcut options, check the table below | object[] | — | — |
| disabledDate | a function determining if a date is disabled with that date as its parameter. Should return a Boolean | function | — | — |
| firstDayOfWeek | first day of week | Number | 1 to 7 | 7 |
| onPick | a callback that triggers when the seleted date is changed. Only for `daterange` and `datetimerange`. | Function({ maxDate, minDate }) | - | - |
### shortcuts
| Attribute | Description | Type | Accepted Values | Default |

View File

@ -303,6 +303,7 @@
| shortcuts | 设置快捷选项,需要传入 { text, onClick } 对象用法参考 demo 或下表 | Object[] | — | — |
| disabledDate | 设置禁用状态,参数为当前日期,要求返回 Boolean | Function | — | — |
| firstDayOfWeek | 周起始日 | Number | 1 到 7 | 7 |
| onPick | 选中日期后会执行的回调,只有当 `daterange``datetimerange` 才生效 | Function({ maxDate, minDate }) | - | - |
### Shortcuts
| 参数 | 说明 | 类型 | 可选值 | 默认值 |

View File

@ -377,9 +377,9 @@
if (this.maxDate === val.maxDate && this.minDate === val.minDate) {
return;
}
this.onPick && this.onPick(val);
this.maxDate = val.maxDate;
this.minDate = val.minDate;
if (!close || this.showTime) return;
this.handleConfirm();
},