picker-options | 当前时间日期选择器特有的选项参考下表 |
shortcuts | 设置快捷选项,需要传入 { text, onClick } 对象用法参考 demo 或下表 | Object[] | — | — |
disabledDate | 设置禁用状态,参数为当前日期,要求返回 Boolean | Function | — | — |
cellClassName | 设置日期的 className | Function(Date) | — | — |
firstDayOfWeek | 周起始日 | Number | 1 到 7 | 7 |
pickerOptions: {
onPick: ({ maxDate, minDate }) => {
this.choiceDate = minDate.getTime()
if (maxDate) {
this.choiceDate = ''
}
},
disabledDate: (time) => {
const self = this;
if (!!self.choiceDate) {
const startDay = (new Date(self.choiceDate).getDate() - 1) * 24 * 3600 * 1000;
const endDay = (new Date(new Date(self.choiceDate).getFullYear(),new Date(self.choiceDate).getMonth() + 1,0).getDate() - new Date(self.choiceDate).getDate()) * 24 * 3600 * 1000;
let minTime = self.choiceDate - startDay;
let maxTime = self.choiceDate + endDay;
return time.getTime() < minTime || time.getTime() > maxTime
}
}
},