element date-picker 限制选择时间范围


 效果如图展示:

picker
          v-model="month"
          type="month"
          :clearable="false"
          placeholder="选择月份"
          format="yyyy 年 MM 月"
          value-format="yyyy-MM"
          style="margin-bottom: 10px; width: 300px"
          :picker-options="pickerOptions()"
        />


pickerOptions() {
      return {
        disabledDate: (time) => {
          const currentYear = new Date().getFullYear();
          const currentMonth = new Date().getMonth();
          // 只能选择当前月份与其前后两个月
          return (
            time.getFullYear() !== currentYear ||
            time.getMonth() > currentMonth + 1 ||
            time.getMonth() < currentMonth - 1
          );
        },
      };
    },