关于element-ui:Elementui时间选择器禁止选择当月之后的月份

html

<el-date-picker
     v-model="fixValue"
       type="month"
       class="fl"
       value-format="yyyy-MM"
       clearable
       size="mini"
       placeholder="抉择日期"
       :picker-options="endDatePicker"
     >
 </el-date-picker>

data数据定义

data(){
    return{
          endDatePicker: this.handelFixDate(),
          fixValue:null
    }
},
methods:
   handelFixDate() {
      console.log(this.fixValue, "132");
      let self = this;
      return {
        disabledDate(time) {
          let t = new Date().getDate();
          // 如果想蕴含本月本月 - 8.64e7 * t 就不须要了,
          // 如果想之前的不能抉择把 > 换成 <
          return time.getTime() > Date.now() - 8.64e7 * t;
        },
      };
    },

————————————————
版权申明:本文为CSDN博主「__不靠谱学生」的原创文章,遵循CC 4.0 BY-SA版权协定,转载请附上原文出处链接及本申明。
原文链接:https://blog.csdn.net/weixin_…

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理