关于element-ui 的日期时间选择器的超出时间无法选择的设置

        <el-form-item label="申请时间">
          <el-date-picker v-model="applicationTime" type="datetimerange" size="small" placeholder="选择日期范围" :picker-options="timeChange" style=" 170px"></el-date-picker>
        </el-form-item>
data() {
    return {
        applicationTime: '',
        timeChange: {
          disabledDate(time){
            console.log(time)
            return time.getTime() < (Date.now() - 3600 * 1000 * 24 * 183) ||time.getTime() > Date.now() //选择时间范围
          }
        },
    }


  created() {
  this.loadtime();
},


methods(){ // 时间控件显示时间 loadtime(){ var date = new Date(); var year = date.getFullYear(); var month = date.getMonth(); var day = date.getDate(); var hours = date.getHours(); var minutes = date.getMinutes(); var seconds = date.getSeconds(); this.time = [new Date(year, month, day, 0, 0, 0), new Date(year, month, day, hours, minutes, seconds)]; this.auditTime = this.time; this.applicationTime = this.time; }, }
原文地址:https://www.cnblogs.com/fenfeiluoye/p/10516826.html