element 单个日期组件 设置范围

eg:只能选择7天

element 单个日期组件 设置范围

 <el-form-item prop="startDate">
            <el-date-picker
              value-format="yyyy-MM-dd"
              type="date"
              placeholder="选择开始日期"
              v-model="queryParams.date"
              :picker-options="DateOptions"
            ></el-date-picker>
          </el-form-item>

7指天数,可以根据要求更改

  DateOptions: {
    disabledDate: time => {
      let curDate = (new Date()).getTime();
        let three = 7 * 24 * 3600 * 1000;
        let threeMonths = curDate - three;
        return time.getTime() > Date.now() || time.getTime() < threeMonths;
    }
  },
上一篇:vue实现vr看360°全景效果


下一篇:Leetcode 628: Maximum Product of Three Numbers