<el-date-picker
  v-model="due_date"
  type="date"
  size="small"
  value-format="yyyy-MM-dd"
  :picker-options="pickerOptions0"
  placeholder="pick date">
</el-date-picker>

1.今日以后

pickerOptions0: {
  disabledDate(time) {
    return time.getTime() < Date.now() - 8.64e7
  }
}

2.前一个月

pickerOptions0: {
  disabledDate(time) {
    const lastMonthTime = new Date().setMonth(new Date().getMonth() - 1)
    return time.getTime() > Date.now() || time < lastMonthTime
  }
}

3.后一个月

pickerOptions0: {
  disabledDate(time) {
    const lastMonthTime = new Date().setMonth(new Date().getMonth() + 1)
    return time.getTime() < Date.now() || time > lastMonthTime
  }
}
作者 铁血 汉子 9 天前
2019/11/15/11:14:39am 2019/11/6/16:47:57
0 21