import { jump } from '../../component/calendar/index.js'; const app = getApp() const conf = { data: { calendarConfig: { // 配置内置主题 theme: 'default' } }, doSomeThing() { // 调用日历方法 this.calendar.enableArea(['2022-3-7', '2022-4-7']); } }; Page({ /** * 选择日期后执行的事件 * currentSelect 当前点击的日期 * allSelectedDays 选择的所有日期(当mulit为true时,allSelectedDays有值) */ afterTapDay(e) { console.log('afterTapDay', e.detail); // => { currentSelect: {}, allSelectedDays: [] } }, onLoad: function(){ app.checkLogin(res=>{ if( !res.userId ){ wx.navigateTo({ url: '/pages/index/index', }) } }) }, /** * 当日历滑动时触发(适用于周/月视图) * 可在滑动时按需在该方法内获取当前日历的一些数据 */ onSwipe(e) { console.log('onSwipe', e.detail); const dates = this.calendar.getCalendarDates(); }, /** * 当改变月份时触发 * => current 当前年月 / next 切换后的年月 */ whenChangeMonth(e) { console.log('whenChangeMonth', e.detail); // => { current: { month: 3, ... }, next: { month: 4, ... }} }, /** * 周视图下当改变周时触发 * => current 当前周信息 / next 切换后周信息 */ whenChangeWeek(e) { console.log('whenChangeWeek', e.detail); // { // current: { currentYM: {year: 2019, month: 1 }, dates: [{}] }, // next: { currentYM: {year: 2019, month: 1}, dates: [{}] }, // directionType: 'next_week' // } }, /** * 日期点击事件(此事件会完全接管点击事件),需自定义配置 takeoverTap 值为真才能生效 * currentSelect 当前点击的日期 */ onTapDay(e) { console.log('onTapDay', e.detail); // => { year: 2019, month: 12, day: 3, ...} }, /** * 日历初次渲染完成后触发事件,如设置事件标记 */ afterCalendarRender(e) { console.log('afterCalendarRender', e); } });