element-ui 日期选择范围限制,只允许选择上下浮动一个月内的日期


pickerOptions: {
          onPick: ({ maxDate, minDate }) => {
            this.choiceDate = minDate.getTime()
            if (maxDate) {
              this.choiceDate = ''
            }
          },
          disabledDate: (time) => {
            if (!isNull(this.choiceDate)) {
              const one = 30 * 24 * 3600 * 1000
              const minTime = this.choiceDate - one
              const maxTime = this.choiceDate + one
              return time.getTime() < minTime || time.getTime() > maxTime
            }
          }
},
choiceDate: ''

 

你可能感兴趣的:(VUE)