<a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol"> <a-form-model-item label="年度/季度" > <a-date-picker mode="year" placeholder="請選擇年份" format='YYYY' v-model="form.yearQuarter" style="width:100%" :open='yearShowOne' @openChange="openChangeOne" @panelChange="panelChangeOne"/> </a-form-model-item> </a-form-model>
年度打開關閉狀態,true為打開,false為關閉
yearShowOne: false
methods: { // 彈出日歷和關閉日歷的回調 openChangeOne(status) { if (status){ this.yearShowOne = true } }, // 得到年份選擇器的值 panelChangeOne(value) { this.form.yearQuarter = value; this.yearShowOne = false; } }