a-range-picker或a-date-picker只能选择月份

									<a-range-picker
                                    :mode="mode2"
                                    format="YYYY-MM"
                                    v-model="yaerMode"
                                    :open="yearShowOne"
                                    @openChange="openChangeOne"
                                    @panelChange="panelChangeOne"
                                />
import moment from 'moment'
mode2:['month', 'month'],//a-range-picker:数组形式的,a-date-picker:字符串形式的:mode2:'month'
yearShowOne:false,
yaerMode:[]  ,  //开始月份,
watch: {//如果点击组件内置的清除,那么我们这些参数也要清空,所以监听下
        yaerMode(newValue, oldValue) {
            if(newValue.length == 0){
                 this.queryParam.releaseTimeStart = ''
                this.queryParam.releaseTimeEnd = ''
            }
        }
    },
openChangeOne(status){
            this.yearShowOne =  !this.yearShowOne
        },
        // 得到月份选择器的值
        panelChangeOne(value){
            this.yaerMode = value
            this.queryParam.releaseTimeStart = moment(value[0]).format('YYYY-MM')
            this.queryParam.releaseTimeEnd = moment(value[1]).format('YYYY-MM')
            this.yearShowOne =  !this.yearShowOne
        },

a-range-picker或a-date-picker只能选择月份_第1张图片

你可能感兴趣的:(javascript,前端,开发语言)