<a-range-picker
:disabled-date="disabledDate"
:disabled-time="disabledRangeTime"
:show-time="{
hideDisabledOptions: true,
defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('11:59:59', 'HH:mm:ss')]
}"
format="YYYY-MM-DD HH:mm:ss"
/>
range (start, end) {
const result = []
for (let i = start; i < end; i++) {
result.push(i)
}
return result
},
disabledDate (current) {
return current < moment().startOf('day')
},
disabledRangeTime (_, type) {
// 禁用当前时间之前的
if (type === 'start') {
return {
disabledHours: () => this.range(0, moment().hour()),
disabledMinutes: () => this.range(0, moment().minute()),
disabledSeconds: () => this.range(0, moment().second())
}
}
return {
// disabledHours: () => [],
// disabledMinutes: () => [],
// disabledSeconds: () => []
}
},
网友评论