需求是超过当前时间的日期是不可以填写的,效果如图
这里可以用Moment的isBefore判断日期的大小
使用
// 判断当前时间是否可以编辑
compareTime(val) {
let curMonth = moment().format("YYYY-MM"); // 获取当前年月
let b = moment(curMonth).isBefore(val.fillObject); // 判断是否在当前时间之前
return b;
},