element-ui el-date-picker 限制范围



pickerOptions: {
  onPick: ({ maxDate, minDate }) => {
    this.pickerMinDate = minDate.getTime()
    if (maxDate) {
      this.pickerMinDate = ''
    }
  },
  disabledDate: time => {
    if (this.pickerMinDate !== '') {
      const day10 = 9 * 24 * 3600 * 1000
      let maxTime = this.pickerMinDate + day10
      let minTime = this.pickerMinDate - day10
      if (maxTime > new Date()) {
        maxTime = new Date()
      }
      return time.getTime() > maxTime || time.getTime() < minTime || time.getTime() > Date.now()
    }
    return time.getTime() > Date.now()
  }
}

你可能感兴趣的:(element-ui el-date-picker 限制范围)