<el-date-picker
v-model="daterange"
value-format="yyyy-MM-dd"
type="daterange"
start-placeholder="开始时间"
end-placeholder="结束时间"
:picker-options="pickerOptions1"
clearable>
</el-date-picker>
pickerOptions1: {
disabledDate(time) {
let curDate = new Date().getTime()
let three = 90 * 24 * 3600 * 1000
let threeMonths = curDate - three
var thatDay = time.getTime()
return time.getTime() > Date.now() || time.getTime() < threeMonths
},
},
pickerOptions2: {
disabledDate(time) {
let curDate = new Date().getTime()
var curD = new Date()
/* 获取当前月份 */
var curMonth = curD.getMonth()
curD.setMonth(curMonth + 1)
curD.setDate(0)
/* 返回当月的天数 */
var days = curD.getDate()
let three = days * 24 * 3600 * 1000
let threeMonths = curDate - three
return time.getTime() > Date.now() - 8.64e7 || time.getTime() < threeMonths
},
},
daterange: [], // 时间
// 时间选择
daterange(val) {
this.dataForm.startDate = val !== null ? val[0] : ''
this.dataForm.endDate = val !== null ? val[1] : ''
},