<div class="selectItem" v-show="yearShow">
<el-date-picker
v-model="curStartYear"
placeholder="请选择开始年份"
style="width: 180px"
type="year"
format="yyyy"
value-format="yyyy"
:picker-options="yearPickerOptionsStart"
:clearable="false"
@change="startYearChange"
/>
~
<el-date-picker
v-model="curEndYear"
placeholder="请选择结束年份"
type="year"
style="width: 180px"
format="yyyy"
value-format="yyyy"
:picker-options="yearPickerOptionsEnd"
:clearable="false"
@change="endYearChange"
>
</el-date-picker>
</div>
data() {
return {
yearPickerOptionsStart: {
disabledDate: (time) => {
const date = new Date()
const year = date.getFullYear()
const timeYear = time.getFullYear()
return timeYear > year || timeYear > this.curEndYear
}
},
yearPickerOptionsEnd: {
disabledDate: (time) => {
const date = new Date()
const year = date.getFullYear()
const timeYear = time.getFullYear()
return timeYear > year || timeYear < this.curStartYear
}
}
}
}