element ui dataPicker 日期范围限制

<el-date-picker
        v-model="time"
        type="datetimerange"
        range-separator="至"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
        :clearable="clearable"
        :picker-options="pickerOptions"
        @change="changeTime"
      ></el-date-picker>
data(){
    return{
pickerOptions: {
        onPick(time) {
          if (!time.maxDate) {
            let timeRange = 1 * 24 * 60 * 60 * 1000  //限制范围
            _minTime = time.minDate.getTime() - timeRange
            _maxTime = time.minDate.getTime() + timeRange
          } else {
            _minTime = _maxTime = null
          }
        },
        disabledDate(time) {
          if (_minTime && _maxTime) {
            return time.getTime() < _minTime || time.getTime() > _maxTime
          } else {
            return time.getTime() < Date.now() - 1 * 24 * 60 * 60 * 1000
          }
        }
      }
    }
}

 

element ui dataPicker 日期范围限制

上一篇:Windows系统常用快捷键


下一篇:[转载] Python 列表(list)、字典(dict)、字符串(string)常用基本操作小结