参考了一下官网api,现在想限制不能选今年(含今年)之后的年份。
<a-date-picker
mode="year"
v-model="dateTime"
placeholder="选择年份"
format="YYYY"
:disabledDate="disableDate"
@panelChange="onChangeYear"
/>
用了这个方法,还是不行,请大神指点。
disableDate(current) {
return current && current > moment().subtract(1, "year") //最开始错误方法
return current && current > moment().startOf("year") //纠正后的方法也无法限制年限
},
-------2021.10.8问题暂时无法解决-----
官方GitHub ISSUES
https://github.com/vueCompone...
目前组件确实有问题,无法限制年限。
moment().subtract(1, "year")是把当前时间减了一年,按理来说应该是今年的起始:
希望能帮助到你。