微信小程序日历的预订系统

废话不多说,从晚上摘了一个日历,修改为可预订系统 ,现在记录一下备忘,我已经把这个日历系统定制为组件,以便以后方便调用.

calendar文件夹下 的三个文件为

calendar.js

// components/calendar/calendar.js
Component({
	/**
	 * 组件的属性列表
	 */
	properties: {
		    workDayNum: { // 激活几个工作日
		      type: Number,
		      value: 7
		    },
			offset: { // 向后顺延几天后预定
			  type: Number,
			  value: 1
			},
			// holidays: { // 添加几个休息日
			//   type: Object,
			//   value: {}
			// },
	},

	/**
	 * 组件的初始数据
	 */
	data: {
		year: 0,
		month: 0,
		date: [日, 一, 二, 三, 四, 五, 六],
		dateArr: [],
		isToday: 0,
		isTodayWeek: false,
		todayIndex: 0,
		
	},
	/**
	 * 组件的方法列表
	 */
	methods: {
		bookatThisDay(e){
			let info=e.currentTarget.dataset;
			let value=`${info.year}-${info.month}-${info.datenum}`;
			let canBook=info.canbook
			this.triggerEvent(bookatThisDay,{value:value,canBook:canBook});
		},
		calculateActiveDays(w
经验分享 程序员 微信小程序 职场和发展