首页 > 其他 > 详细

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

时间:2020-09-14 12:41:14      阅读:324      评论:0      收藏:0      [点我收藏+]

官方网站中组件的介绍

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

  

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!