mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(router): writeURL() for non root base
This commit is contained in:
@@ -58,7 +58,16 @@ export function readNavState(root: HTMLElement | undefined) {
|
||||
return {ids, outlet};
|
||||
}
|
||||
|
||||
const QUERY = ':not([no-router]) ion-nav,:not([no-router]) ion-tabs, :not([no-router]) ion-router-outlet';
|
||||
export function waitUntilNavNode(win: Window) {
|
||||
if (searchNavNode(win.document.body)) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
win.addEventListener('ionNavWillLoad', resolve, { once: true });
|
||||
});
|
||||
}
|
||||
|
||||
const QUERY = ':not([no-router]) ion-nav, :not([no-router]) ion-tabs, :not([no-router]) ion-router-outlet';
|
||||
|
||||
function searchNavNode(root: HTMLElement|undefined): NavOutletElement|null {
|
||||
if (!root) {
|
||||
|
||||
@@ -26,10 +26,12 @@ export function chainToPath(chain: RouteChain): string[]|null {
|
||||
return path;
|
||||
}
|
||||
|
||||
export function writePath(history: History, base: string, usePath: boolean, path: string[], direction: RouterDirection, state: number) {
|
||||
path = [base, ...path];
|
||||
let url = generatePath(path);
|
||||
if (usePath) {
|
||||
export function writePath(history: History, root: string, useHash: boolean, path: string[], direction: RouterDirection, state: number) {
|
||||
let url = generatePath([
|
||||
...parsePath(root),
|
||||
...path
|
||||
]);
|
||||
if (useHash) {
|
||||
url = '#' + url;
|
||||
}
|
||||
if (direction === RouterDirection.Forward) {
|
||||
|
||||
Reference in New Issue
Block a user