效果图片

代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<el-date-picker
v-model="value1"
type="monthrange"
range-separator="至"
start-placeholder="开始月份"
end-placeholder="结束月份"
:picker-options="pickerOptions"
>
</el-date-picker>


curDate: "",
pickerOptions: {
onPick: ({ maxDate, minDate }) => {
this.curDate = minDate.getTime();
if (maxDate) {
this.curDate = "";
}
},
disabledDate: (time) => {
let oldDate = new Date('2021-12-31T12:00:00.000Z') #最小日期
let oneYear = new Date(oldDate).getTime();
return (
time.getTime() > Date.now() ||
time.getTime() < oneYear
);
},
},
value1: "",