antd 日期选择器 指定日期可选?

新手上路,请多包涵

需求中要在日期组件中仅后端传入的时间可选,我这样实现:

disabledDate(current) {
    return  current && !this.dateList.some(item => current.isSame(item))
}

但由于dateList中日期大概2000个,遍历return后会非常卡,想请教一下在antd中有没有更好的办法设置指定日期可选!

阅读 3k
2 个回答

dateList 如果是连续的日期可以最大最小值比较,或者 current 转成时间字符串 dateList.includes 来判断

current && current > moment().endOf('day') || current < moment(new Date()).subtract(1, 'months')

推荐问题