|
@@ -10,7 +10,8 @@ list:{type:Object,default:{}},/**
|
|
* 下一月,暂无限制
|
|
* 下一月,暂无限制
|
|
*/nextMonth:{type:Function,default:function _default(date){}},/**
|
|
*/nextMonth:{type:Function,default:function _default(date){}},/**
|
|
* 日期选择结束时触发
|
|
* 日期选择结束时触发
|
|
- */selectDay:{type:Function,default:function _default(obj){}}},data:function data(){return{minDate:new Date(),maxDate:new Date(),currentDate:new Date(),// 当前日历日期
|
|
|
|
|
|
+ */selectDay:{type:Function,default:function _default(obj){}},isSkipHolidays:{// 是否跳过节假日
|
|
|
|
+type:Boolean,default:false}},data:function data(){return{minDate:new Date(),maxDate:new Date(),currentDate:new Date(),// 当前日历日期
|
|
subtitle:'',show:false,dayList:[],selectDays:[]};},computed:{arrowStatus:function arrowStatus(){// 上月箭头状态
|
|
subtitle:'',show:false,dayList:[],selectDays:[]};},computed:{arrowStatus:function arrowStatus(){// 上月箭头状态
|
|
return!dayjs().isBefore(dayjs(this.currentDate),'month');},selectDayTitle:function selectDayTitle(){// 选中日期标题
|
|
return!dayjs().isBefore(dayjs(this.currentDate),'month');},selectDayTitle:function selectDayTitle(){// 选中日期标题
|
|
return dayjs(this.currentDate).format('YYYY-MM-DD');},isPrevDay:function isPrevDay(){// 是否可以点击上一天
|
|
return dayjs(this.currentDate).format('YYYY-MM-DD');},isPrevDay:function isPrevDay(){// 是否可以点击上一天
|
|
@@ -19,7 +20,8 @@ return dayjs(this.currentDate).add(1,'day').isAfter(dayjs(this.maxDate),'day');}
|
|
this.subtitle=dayjs().format('YYYY年MM月');this.maxDate=dayjs().endOf('month').toDate();this.minDate=dayjs().add(1,'day').toDate();// 初始化日历
|
|
this.subtitle=dayjs().format('YYYY年MM月');this.maxDate=dayjs().endOf('month').toDate();this.minDate=dayjs().add(1,'day').toDate();// 初始化日历
|
|
// console.log(this.list, 323, this.maxDays)
|
|
// console.log(this.list, 323, this.maxDays)
|
|
},methods:{formatter:function formatter(date){var dateStr=dayjs(date.date).format('YYYY-MM-DD');var dateObj=this.list[dateStr];// 判断是否有课程 并且 时间在当前时间之后
|
|
},methods:{formatter:function formatter(date){var dateStr=dayjs(date.date).format('YYYY-MM-DD');var dateObj=this.list[dateStr];// 判断是否有课程 并且 时间在当前时间之后
|
|
-if(dateObj&&dayjs().isBefore(dayjs(date.date))){var _dateObj$courseTime;if(dateObj&&(dateObj.fullCourse||!(dateObj!==null&&dateObj!==void 0&&dateObj.courseTime)||(dateObj===null||dateObj===void 0?void 0:(_dateObj$courseTime=dateObj.courseTime)===null||_dateObj$courseTime===void 0?void 0:_dateObj$courseTime.length)<=0)){date.bottomInfo='满';date.className='full';date.type='disabled';}}else{date.type='disabled';}date.type=date.type==='selected'?'':date.type;return date;},onPrevMonth:function onPrevMonth(){// 上一月
|
|
|
|
|
|
+if(dateObj&&dayjs().isBefore(dayjs(date.date))){var _dateObj$courseTime;if(dateObj&&(dateObj.fullCourse||!(dateObj!==null&&dateObj!==void 0&&dateObj.courseTime)||(dateObj===null||dateObj===void 0?void 0:(_dateObj$courseTime=dateObj.courseTime)===null||_dateObj$courseTime===void 0?void 0:_dateObj$courseTime.length)<=0)){date.bottomInfo='满';date.className='full';date.type='disabled';}}else{date.type='disabled';}if(dateObj&&this.isSkipHolidays&&dateObj.holiday){// date.bottomInfo = '节假日'
|
|
|
|
+date.type='disabled';}date.type=date.type==='selected'?'':date.type;return date;},onPrevMonth:function onPrevMonth(){// 上一月
|
|
if(this.arrowStatus)return;var tempDate=dayjs(this.currentDate).subtract(1,'month');this._monthChange(tempDate);this.prevMonth&&this.prevMonth(this.minDate);},onNextMonth:function onNextMonth(){// 下一月
|
|
if(this.arrowStatus)return;var tempDate=dayjs(this.currentDate).subtract(1,'month');this._monthChange(tempDate);this.prevMonth&&this.prevMonth(this.minDate);},onNextMonth:function onNextMonth(){// 下一月
|
|
var tempDate=dayjs(this.currentDate).add(1,'month');this._monthChange(tempDate);this.nextMonth&&this.nextMonth(this.minDate);},_monthChange:function _monthChange(date){// 月份改变
|
|
var tempDate=dayjs(this.currentDate).add(1,'month');this._monthChange(tempDate);this.nextMonth&&this.nextMonth(this.minDate);},_monthChange:function _monthChange(date){// 月份改变
|
|
// 需要判断是否是当月,需要单独处理最小时间
|
|
// 需要判断是否是当月,需要单独处理最小时间
|