Files
dataease/core/core-frontend/src/router/embedded.ts
2025-02-18 17:01:55 +08:00

25 lines
572 B
Java

import { createRouter, createWebHashHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'
import type { App } from 'vue'
export const routes: AppRouteRecordRaw[] = []
const router = createRouter({
history: createWebHashHistory(),
routes: routes as RouteRecordRaw[]
})
const rawInstall = router.install
router.install = app => {
const hash = window.location.hash
rawInstall(app)
setTimeout(() => {
window.location.hash = hash
}, 100)
}
export const setupRouter = (app: App<Element>) => {
app.use(router)
}
export default router