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


官方网站中组件的介绍

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’);当天之前的不可选,包括当天
      },

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM