@@ -193,28 +193,30 @@ export default {
193193
194194 }
195195 return {
196- dates: [],
197196 options: {
198197 shortcuts: shortcuts,
199198 disabledDate : date => {
200199 let initdate = ' ' ;
201- if (this .dates .length === 0 ) {
202- return false ;
203- }
204- if (this .dates .length === this .field .maxLength
205- && this .field .subtype === ' date'
206- && this .field .multiple ) {
207- return ! this .dates .some (ret => {
200+ if (this .field .subtype === ' date' && this .field .multiple ) {
201+ if (! this .value ) {
202+ return false ;
203+ }
204+ const selectedDates = this .value .split (' ,' ) || [];
205+ if (selectedDates .length !== this .field .maxLength ) {
206+ return false ;
207+ }
208+
209+ return ! selectedDates .some (item => {
208210 if (this .field .format === ' yyyyMMdd' ) {
209- initdate = new Date (ret .split (/ (\d {4} )(\d {2} )(\d {2} )/ ));
211+ initdate = new Date (item .split (/ (\d {4} )(\d {2} )(\d {2} )/ ));
210212 } else {
211- initdate = new Date (ret .split (/ \D + / ));
213+ initdate = new Date (item .split (/ \D + / ));
212214 }
213215 return date && date .valueOf () === initdate .valueOf () ;
214216 });
215217 }
216- // disabledDates 的格式为 [[, 2018-12-30], [2019-1-30, 2019-2-30], [2019-3-30,]]
217- // 只要满足 disabledDates 中任意一个区间,则禁用。
218+ // disabledselectedDates 的格式为 [[, 2018-12-30], [2019-1-30, 2019-2-30], [2019-3-30,]]
219+ // 只要满足 disabledselectedDates 中任意一个区间,则禁用。
218220 return disabledDates .some (daterange => {
219221 const startTime = daterange[0 ] ? (new Date (daterange[0 ])).getTime () : - Infinity ;
220222 const endTime = daterange[1 ] ? new Date (daterange[1 ]).getTime () : Infinity ;
@@ -256,7 +258,6 @@ export default {
256258 methods: {
257259 handleChange (value ) {
258260 this .$emit (' on-change' , this .field .model , value, null , this .field );
259- this .dates = value .split (' ,' );
260261 }
261262 }
262263};
0 commit comments