Files
harmony-client/entry/src/main/ets/router/AppRouter.ets

31 lines
673 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 应用级导航封装:持有全局 NavPathStack,页面通过静态方法导航。
*/
export class AppRouter {
private static stack: NavPathStack | null = null;
static init(stack: NavPathStack): void {
AppRouter.stack = stack;
}
static push(name: string, param?: Object): void {
AppRouter.stack?.pushPathByName(name, param);
}
static replace(name: string, param?: Object): void {
AppRouter.stack?.replacePathByName(name, param);
}
static pop(): void {
AppRouter.stack?.pop();
}
static popToName(name: string): void {
AppRouter.stack?.popToName(name);
}
static clear(): void {
AppRouter.stack?.clear();
}
}