当前为2020-03月;
需求只能选择当月之前的月分
<el-date-picker
v-model="search.yearMonth"
format="yyyy-MM"
value-format="yyyy-MM"
class="control"
type="month"
placeholder="选择时间"
:picker-options="pickerOptionsYearMonth"
/>
data() {
return {
pickerOptionsYearMonth: this.banTime(),
}
},
methods: {
// 大于当前月分的日期不可选
banTime() {
return {
disabledDate(time) {
const date = new Date()
const year = date.getFullYear()
let month = date.getMonth() + 1
if (month >= 1 && month <= 9) {