Trigger
最低版本: 1.0.0最后更新: 2020/10/28类说明:
页面路由跳转类。
支持平台:
平台 | 是否支持 |
豹小秘 | 是 |
豹大/花瓶 | 是 |
豹小秘 Mini | 是 |
方法
方法名 | 参数 | JS类型 | 参数说明 | 方法说明 | 最低版本 |
trigger | protocol | TriggerProtocol | trigger信息 | ViewModel 中触发 trigger 跳转 | 1.0.0 |
navSwitch | from | string | 来源页面 | 触发路由跳转 | 1.0.0 |
to | string | 目标页面 | |||
goBack | protocol | TriggerProtocol | trigger信息 | 路由退栈 | 1.0.0 |
实例代码
export class HomeTrigger extends Trigger {
public constructor() {
super(TriggerChannel.home);
}
public navSwitch = (from: string, to: string): void => {
ModuleChangeReportStatus.Instance().switchTask(to);
};
public trigger = (protocol: TriggerProtocol): void => {
console.log('HomeTrigger protocol.eventId ', protocol.eventId);
switch (protocol.eventId) {
case HomeEvent.weather:
this._trigger(TriggerChannel.weather, protocol);
break;
default:
this._trigger(TriggerChannel.wakeUp, protocol);
break;
}
};
}