https://antdv.com/docs/vue/introduce-cn/
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<
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
1
2
3
4
5
6
7
8
9
10
11
12
13
|
methods: {
// 彈出日歷和關閉日歷的回調
openChangeOne(status) {
if
(status){
this
.yearShowOne =
true
}
},
// 得到年份選擇器的值
panelChangeOne(value) {
this
.form.yearQuarter = value;
this
.yearShowOne =
false
;
}
}
|
<a-date-picker
mode="year"
placeholder="請選擇年份"
format='YYYY'
v-model="searchForm.year"
style="width:100%"
:open='yearShowOne'
@openChange="openChangeOne"
@panelChange="panelChangeOne"/>
yearShowOne: false,
openChangeOne(status) {
if (status){
this.yearShowOne = true
}
},
// 得到年份選擇器的值
panelChangeOne(value) {
let aa = value.toString();
this.searchForm.year= aa.substring(11,15);
this.yearShowOne = false;
}