@tarojs/router
Version:
Taro-router
54 lines (53 loc) • 2.5 kB
TypeScript
import NavigationBarHandler from './navigation-bar';
import type { PageInstance } from '@tarojs/runtime';
import type { PageConfig, RouterAnimate } from '@tarojs/taro';
import type { History } from 'history';
import type { Route, SpaRouterConfig } from '../../types/router';
export default class PageHandler {
history: History;
config: SpaRouterConfig;
protected readonly defaultAnimation: RouterAnimate;
protected unloadTimer: ReturnType<typeof setTimeout> | null;
protected hideTimer: ReturnType<typeof setTimeout> | null;
protected lastHidePage: HTMLElement | null;
protected lastUnloadPage: PageInstance | null;
protected navigationBarHandler: NavigationBarHandler;
homePage: string;
originHomePage: string;
constructor(config: SpaRouterConfig, history: History);
get currentPage(): string;
get appId(): string;
get router(): import("../../types/router").Router;
get routerMode(): "hash" | "browser" | "multi";
get customRoutes(): Record<string, string | string[]>;
get routes(): Route[];
get tabBarList(): import("@tarojs/taro").TabBarItem[];
get PullDownRefresh(): any;
get animation(): boolean | RouterAnimate;
get animationDelay(): number;
get animationDuration(): number;
set pathname(p: string);
get pathname(): string;
get originPathname(): string;
get basename(): string;
get pageConfig(): Route | undefined;
isTabBar(pathname: string): boolean;
isDefaultNavigationStyle(): boolean;
isSamePage(page?: PageInstance | null): boolean;
get search(): string;
get usingWindowScroll(): boolean;
getQuery(stamp?: string, search?: string, options?: Record<string, unknown>): {
[x: string]: unknown;
};
mount(): void;
onReady(page: PageInstance, onLoad?: boolean): void;
load(page: PageInstance, pageConfig: Route | undefined, stampId: string, pageNo?: number): void;
unload(page?: PageInstance | null, delta?: number, top?: boolean): void;
show(page?: PageInstance | null, pageConfig?: Route, pageNo?: number): void;
hide(page?: PageInstance | null, animation?: boolean): void;
addAnimation(pageEl?: HTMLElement | null, first?: boolean): void;
getPageContainer(page?: PageInstance | null): HTMLElement | null;
getScrollingElement(page?: PageInstance | null): (Window & typeof globalThis) | HTMLElement;
bindPageEvents(page: PageInstance, config?: Partial<PageConfig>): void;
triggerRouterChange(): void;
}