antd日期选择器禁止选择当天之前的时间

时间:2020-09-14 12:41:14   收藏:0   阅读:329

官方网站中组件的介绍

https://www.antdv.com/components/calendar-cn/#API

 

使用disabledDate属性(不可选择的日期)

<a-date-picker @change="dateChange" :disabledDate="disabledDate" v-decorator="[‘endDate‘]"/>

  

 在js中定义函数并返回

 

 //限制当天之前的日期不可选
      disabledDate(current) {
        return current && current <moment().subtract(1, "days"); //当天之前的不可选,不包括当天
        //return current && current < moment().endOf(‘day’);当天之前的不可选,包括当天
      },

  

原文:https://www.cnblogs.com/cerofang/p/13665904.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!