当前年
<el-date-picker
v-model="form.nowYear"
type="date"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
placeholder="选择当前年份"
:picker-options="pickerOptions"
/>
pickerOptions: {
disabledDate(time) {
var year = new Date().getFullYear()
return (
time.getTime() > new Date(year + '-12-31').getTime() ||
time.getTime() < new Date(year + '-01-01').getTime()
)
}
}
最多当前年
<el-date-picker
size="small"
value-format="yyyy"
:picker-options="pickerOptions"
v-model="formSearch.year"
type="year"
placeholder="选择月">
</el-date-picker>
pickerOptions: {
disabledDate(time) {
var year = new Date().getFullYear()
return (
time.getTime() > new Date(year + '-12-31').getTime()
)
}
},
版权声明:本文为weixin_44286765原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。