// necessary for webpack
///<reference path="../src/global.d.ts"/>
-import { createApp, App as Application } from 'vue'
+import { createApp, ComponentPublicInstance } from 'vue'
import { router, routerHistory } from './router'
import { globalState } from './store'
import App from './App.vue'
// h: HTML5History
h: typeof routerHistory
r: typeof router
- vm: ReturnType<Application['mount']>
+ // @ts-expect-error
+ vm: ComponentPublicInstance
}
}
window.r = router
const app = createApp(App)
+app.mixin({
+ beforeRouteEnter() {
+ console.log('mixin enter')
+ },
+})
+
app.provide('state', globalState)
app.use(router)
-import { createRouter, createWebHistory } from '../src'
+import { createRouter, createWebHistory, RouterView } from '../src'
import Home from './views/Home.vue'
import Nested from './views/Nested.vue'
import NestedWithId from './views/NestedWithId.vue'
import { globalState } from './store'
import { scrollWaiter } from './scrollWaiter'
import RepeatedParams from './views/RepeatedParams.vue'
+import { FunctionalComponent, h } from 'vue'
let removeRoute: (() => void) | undefined
+const TransparentWrapper: FunctionalComponent = () => h(RouterView)
+TransparentWrapper.displayName = 'NestedView'
+
export const routerHistory = createWebHistory()
export const router = createRouter({
history: routerHistory,
} else next()
},
},
+
+ {
+ path: '/admin',
+ component: TransparentWrapper,
+ children: [
+ { path: '', component },
+ { path: 'dashboard', component },
+ { path: 'settings', component },
+ ],
+ },
],
async scrollBehavior(to, from, savedPosition) {
await scrollWaiter.wait()