Vue+ElementUI 限制结束时间不能大于开始时间

el-date-picker 组件的 picker-options属性

直接上代码

 
        
          
            
          
        
        
        
          
            
          
        
      

 

data(){
return{
sxyInfo:{},
pickerOptionsStart: {
        disabledDate: time => {
          let endDateVal = this.sxyInfo.enddate;
          if (endDateVal) {
            return time.getTime() > new Date(endDateVal).getTime();
          }
        }
      },
      pickerOptionsEnd: {
        disabledDate: time => {
          let beginDateVal = this.sxyInfo.startdate;
          if (beginDateVal) {
            return (
              time.getTime() <
              new Date(beginDateVal).getTime() - 1 * 24 * 60 * 60 * 1000
            );
          }
        }
      },
}
}

 

你可能感兴趣的:(web前端)