简直是无语子,记录一下,年和月同理,因为懒就写了月,直接上代码,不想解释,累了
<a-range-pickerformat="YYYY-MM":mode="mode":allowClear="false"v-model="rangeValue":open="isRangeOpen"@openChange="openRangeChange"@panelChange="handlePanelChange2"@change="handleRangeChange"
/>
- data
data() {return {rangeValue:[moment().subtract(2, 'months'), moment()],mode:['month', 'month'],isRangeOpen:false};},
- methods
methods:{openRangeChange(status) {if(status) {this.isRangeOpen = true;} else {this.isRangeOpen = false;}},handlePanelChange2(value) {this.rangeValue = value;this.isRangeOpen = false;},handleRangeChange(value) {this.rangeValue = value;},}
rangepicker的时候 mode
等于 year
/[month, month]
/[year, 'year']
的时候同样适用,官方问题解决中也有链接可以参考。