el-date-picker 日期选择器,设置固定月份
selectMonths(num, sign) {
var nowDate = new Date()
var year = nowDate.getFullYear()
var month = nowDate.getMonth() + 1
var startMonth = '',
endMonth = ''
if (month - num <= 0) {
startMonth = year - 1 + '-' + (12 - (num - month)).toString().padStart(2, '0')
} else {
startMonth = year + '-' + (month - num).toString().padStart(2, '0')
}
let _num = sign == 'defalut' ? 0 : 1
if (month - 1 == 0) {
endMonth = year - 1 + '-' + (12 - (_num - month)).toString().padStart(2, '0')
} else {
endMonth = year + '-' + (month - _num).toString().padStart(2, '0')
}
return {startMonth,endMonth}
}