elementui 日期选择器 只选择自己想选的年月

//只选择自己想选择的一些年月不包括日哦~

<el-date-picker
  v-model="value2"
    type="monthrange"
    align="right"
    unlink-panels
    range-separator="至"
    start-placeholder="开始月份"
    end-placeholder="结束月份"
    :picker-options="pickerOptionsEndequivalent"
  >
  </el-date-picker>

return {
      // 参考当量-月份区间选择
      creactMonthArr:['2022-05','2022-08'],
      pickerOptionsEndequivalent: {
        disabledDate: (time) => {
          // console.log(time)
          const year = time.getFullYear()
          let month = time.getMonth() + 1
          if (month < 10) month = '0' + month
          const ym = year + '-' + month
          return !this.creactMonthArr.includes(ym)
        },
      },
}

你可能感兴趣的:(elementui,data,日期选择器)