跳转到主要内容

onBeforeViewChange

Description

在用户从当前视图切换到另一个视图之前触发

onBeforeViewChange: (old_mode: string, old_date: object, mode: string, date: object) => boolean

Parameters

  • old_mode - (required) string - 当前激活的视图
  • old_date - (required) object - 当前聚焦的日期
  • mode - (required) string - 即将激活的视图
  • date - (required) object - 被选择的新日期

Returns

  • result - (boolean) - 指示是否应继续执行默认事件操作(true)或阻止操作(false

Example

scheduler.attachEvent("onBeforeViewChange", function(old_mode,old_date,mode,date){
// 可以在这里添加自定义逻辑
return true;
});

Details

  • 通过返回 false 可以阻止此事件,从而保持调度器停留在当前视图。
  • 当调度器首次加载页面时,该事件也会触发;此时,old_modeold_date 将是未定义的。
Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.