-
Notifications
You must be signed in to change notification settings - Fork 13.5k
/
index.ts
36 lines (29 loc) · 1.19 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { App } from 'vue';
import {
createRouter as createVueRouter,
createWebHistory as createVueWebHistory,
createWebHashHistory as createVueWebHashHistory,
createMemoryHistory as createVueMemoryHistory
} from 'vue-router';
import { createIonRouter } from './router';
import { createViewStacks } from './viewStacks';
import { IonicVueRouterOptions } from './types';
export const createRouter = (opts: IonicVueRouterOptions) => {
const routerOptions = { ...opts };
delete routerOptions.tabsPrefix;
const router = createVueRouter(routerOptions);
const ionRouter = createIonRouter(opts, router);
const viewStacks = createViewStacks(router);
const oldInstall = router.install.bind(router);
router.install = (app: App) => {
app.provide('navManager', ionRouter);
app.provide('viewStacks', viewStacks);
oldInstall(app);
};
const oldIsReady = router.isReady.bind(router);
router.isReady = () => oldIsReady();
return router;
}
export const createWebHistory = (base?: string) => createVueWebHistory(base);
export const createWebHashHistory = (base?: string) => createVueWebHashHistory(base);
export const createMemoryHistory = (base?: string) => createVueMemoryHistory(base);