ant 年份選擇器

      <a-date-picker
        v-model="yearValue"
        mode="year"
        format="YYYY"
        value-format="YYYY"
        style="width: 100px"
        :open="yearShowOne"
        :allow-clear="false"
        :disabled-date="(current) => current && current.isBefore('2022')"
        @openChange="openChangeOne"
        @panelChange="panelChangeOne"
      >
        <a-icon slot="suffixIcon" />
      </a-date-picker>
   // 彈出日曆和關閉日曆的回調
    openChangeOne(status) {
      if (status) {
        this.yearShowOne = true
      }
    },
    // 得到年份選擇器的值
    panelChangeOne(value) {
      this.yearShowOne = false
      this.yearValue = moment(value).format('YYYY')
    }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章