UNPKG

@alicd/crui-time-picker-field

Version:

时间选择器

47 lines (39 loc) 1.07 kB
--- order: 3 title: 禁用 --- ````jsx import TimePickerField from '@alicd/crui-time-picker-field'; import { Form } from '@alicd/next'; function disabledHours() { return [6, 12, 18, 23]; } function disabledMinutes() { return [10, 20, 30, 40, 50]; } function disabledSeconds() { return [10, 20, 30, 40, 50]; } ReactDOM.render( <Form> <TimePickerField label="禁用全部" disabled defaultValue="11:11:11" /> <TimePickerField label="禁用时" disabledHours={disabledHours} /> <TimePickerField label="禁用分" disabledMinutes={disabledMinutes} /> <TimePickerField label="禁用秒" disabledSeconds={disabledSeconds} /> </Form>, mountNode ); ```` ```` template <Form> <TimePickerField label="只能选明天以后" disabledDate={this.disabledDate} /> </Form> ```` ```` javascript walle.view.extend({ disabledDate: function(calendarDate){ var theDate = walle.ui.moment(calendarDate.year + '-' + (calendarDate.month + 1) + '-' + calendarDate.date, 'YYYY-MM-DD'); return theDate < new Date().getTime(); } }) ````