|
|
@ -29,6 +29,10 @@ export interface Router {
|
|
|
|
* updated). Return `false` to cancel the navigation.
|
|
|
|
* updated). Return `false` to cancel the navigation.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
onBeforePageLoad?: (to: string) => Awaitable<void | boolean>
|
|
|
|
onBeforePageLoad?: (to: string) => Awaitable<void | boolean>
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Called after the page component is loaded (before the page component is updated).
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
onAfterPageLoad?: (to: string) => Awaitable<void>
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Called after the route changes.
|
|
|
|
* Called after the route changes.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -94,6 +98,8 @@ export function createRouter(
|
|
|
|
throw new Error(`Invalid route component: ${comp}`)
|
|
|
|
throw new Error(`Invalid route component: ${comp}`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await router.onAfterPageLoad?.(href)
|
|
|
|
|
|
|
|
|
|
|
|
route.path = inBrowser ? pendingPath : withBase(pendingPath)
|
|
|
|
route.path = inBrowser ? pendingPath : withBase(pendingPath)
|
|
|
|
route.component = markRaw(comp)
|
|
|
|
route.component = markRaw(comp)
|
|
|
|
route.data = import.meta.env.PROD
|
|
|
|
route.data = import.meta.env.PROD
|
|
|
|