新增allowDays和notAllowDays参数。

应用场景为节假日选择和业务相关,由后台返回。更加灵活
pull/79/head
liuning 2018-10-18 10:44:52 +08:00
parent bfc0c1bf6d
commit f97c162112
1 changed files with 1052 additions and 1031 deletions

View File

@ -989,6 +989,27 @@
isOut = timestrap.now < timestrap.min || timestrap.now > timestrap.max; isOut = timestrap.now < timestrap.min || timestrap.now > timestrap.max;
elem && elem[isOut ? 'addClass' : 'removeClass'](DISABLED); elem && elem[isOut ? 'addClass' : 'removeClass'](DISABLED);
//禁止选择日期
let notAllowDays = options.notAllowDays;
if (notAllowDays != undefined && notAllowDays.length != 0) {
var isMatch = notAllowDays.some(function (day) {
return new Date(day + ' 00:00:00').getTime() == timestrap.now;
})
if (isMatch) {
isOut = isMatch;
}
}
//允许选择日期
let allowDays = options.allowDays;
if (allowDays != undefined && allowDays.length != 0) {
var isMatch = allowDays.some(function (day) {
return new Date(day + ' 00:00:00').getTime() == timestrap.now;
})
if (isMatch) {
isOut = !isMatch;
}
}
return isOut; return isOut;
}; };