zoukankan      html  css  js  c++  java
  • element-ui 日期插件让结束日期大于开始日期

     <el-date-picker
                  v-model="addForm.startDate"
                  type="date"
                  size="mini"
                  format="yyyy-MM-dd"
                  value-format="yyyy-MM-dd"
                  placeholder="开始时间"
                  :picker-options="pickerOptionsStart"
                >
                </el-date-picker>
    <el-date-picker
    v-model="addForm.endDate"
    type="date"
    size="mini"
    format="yyyy-MM-dd"
    value-format="yyyy-MM-dd"
    placeholder="选择日期"
    :picker-options="pickerOptionsEnd"
    >
    </el-date-picker>
     export default {
        data() {
          return {
    
          pickerOptionsStart: {
              disabledDate: time => {
                let endDateVal = this.addForm.endDate;
                if (endDateVal) {
                  return time.getTime() > new Date(endDateVal).getTime();
                }
              }
            },
            pickerOptionsEnd: {
              disabledDate: time => {
                let beginDateVal = this.addForm.startDate;
                if (beginDateVal) {
                  return (
                    time.getTime() <
                    new Date(beginDateVal).getTime() - 1 * 24 * 60 * 60 * 1000
                  );
                }
              }
            },
    
    
    }
    }
    }
  • 相关阅读:
    uva 532
    uva 10557
    uva 705
    uva 784
    uva 657
    uva 572
    uva 10562
    usa物价统计
    2019/6/30,道歉书
    名词收集
  • 原文地址:https://www.cnblogs.com/xieli26/p/10109625.html
Copyright © 2011-2022 走看看