<template> <a-form-item label="考勤年份"> <a-space direction="vertical"> <a-date-picker mode="year" placeholder="请选择年份" format='YYYY' v-model="form.value1" style="100%" :open='yearShowOne' @openChange="openChangeOne" @panelChange="panelChangeOne" /> </a-space> </a-form-item> </template> <script> data() { return { form: { value1: '' }, yearShowOne: false, //年度打开关闭状态,true为打开,false为关闭 } }, methods: { // 弹出日历和关闭日历的回调 openChangeOne(status) { if (status) { this.yearShowOne = true } }, // 得到年份选择器的值 panelChangeOne(value) { this.form.value1 = value; this.yearShowOne = false; }, } </script>