Browse Source

Fix date-picker onOk

pull/986/head
afc163 9 years ago
parent
commit
11f6582235
  1. 7
      components/date-picker/RangePicker.jsx
  2. 5
      components/date-picker/index.jsx
  3. 3
      components/date-picker/index.md

7
components/date-picker/RangePicker.jsx

@ -15,8 +15,8 @@ export default React.createClass({
endPlaceholder: '结束日期', endPlaceholder: '结束日期',
transitionName: 'slide-up', transitionName: 'slide-up',
popupStyle: {}, popupStyle: {},
onChange() { onChange() {},
}, // onChange Validator onOk() {},
locale: {}, locale: {},
align: { align: {
offset: [0, -9], offset: [0, -9],
@ -63,7 +63,7 @@ export default React.createClass({
defaultCalendarValue.setTime(Date.now()); defaultCalendarValue.setTime(Date.now());
const { disabledDate, showTime, size, startPlaceholder, endPlaceholder, const { disabledDate, showTime, size, startPlaceholder, endPlaceholder,
transitionName, disabled, popupStyle, align, style } = this.props; transitionName, disabled, popupStyle, align, style, onOk } = this.props;
const state = this.state; const state = this.state;
const timePicker = showTime const timePicker = showTime
@ -84,6 +84,7 @@ export default React.createClass({
disabledDate={disabledDate} disabledDate={disabledDate}
dateInputPlaceholder={[startPlaceholder, endPlaceholder]} dateInputPlaceholder={[startPlaceholder, endPlaceholder]}
locale={locale.lang} locale={locale.lang}
onOk={onOk}
defaultValue={[defaultCalendarValue, defaultCalendarValue]} defaultValue={[defaultCalendarValue, defaultCalendarValue]}
showClear /> showClear />
); );

5
components/date-picker/index.jsx

@ -16,8 +16,8 @@ function createPicker(TheCalendar, defaultFormat) {
format: defaultFormat || 'yyyy-MM-dd', format: defaultFormat || 'yyyy-MM-dd',
transitionName: 'slide-up', transitionName: 'slide-up',
popupStyle: {}, popupStyle: {},
onChange() { onChange() {},
}, // onChange Validator onOk() {},
locale: {}, locale: {},
align: { align: {
offset: [0, -9], offset: [0, -9],
@ -81,6 +81,7 @@ function createPicker(TheCalendar, defaultFormat) {
prefixCls="ant-calendar" prefixCls="ant-calendar"
className={calendarClassName} className={calendarClassName}
showOk={this.props.showTime} showOk={this.props.showTime}
onOk={this.props.onOk}
showClear /> showClear />
); );

3
components/date-picker/index.md

@ -36,7 +36,7 @@
| size | 输入框大小,`large` 高度为 32px,`small` 为 22px,默认是 28px | string | 无 | | size | 输入框大小,`large` 高度为 32px,`small` 为 22px,默认是 28px | string | 无 |
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/issues/424) | | locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/issues/424) |
| showTime | 增加时间选择功能 | bool | false | | showTime | 增加时间选择功能 | bool | false |
| onOk | 点击确定按钮的回调 | function | 无 | | onOk | 点击确定按钮的回调 | function(Date value) | 无 |
### RangePicker ### RangePicker
@ -46,6 +46,7 @@
| defaultValue | 默认日期 | [string|Date, string|Date] | 无 | | defaultValue | 默认日期 | [string|Date, string|Date] | 无 |
| format | 展示的日期格式 | string | "yyyy-MM-dd HH:mm:ss" | | format | 展示的日期格式 | string | "yyyy-MM-dd HH:mm:ss" |
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function([Date start, Date end]) | 无 | | onChange | 时间发生变化的回调,发生在用户选择时间时 | function([Date start, Date end]) | 无 |
| onOk | 点击确定按钮的回调 | function(Date value) | 无 |
`disabled` `style` `popupStyle` `size` `locale` `showTime` `onOk` 属性与 DatePicker 的一致。 `disabled` `style` `popupStyle` `size` `locale` `showTime` `onOk` 属性与 DatePicker 的一致。

Loading…
Cancel
Save