fix(嵌入式): 嵌入式路由调整

This commit is contained in:
dataeaseShu 2025-02-18 10:46:47 +08:00 committed by Junjun
parent 8e57e7f9f9
commit e84d8bc860

View File

@ -3,31 +3,22 @@ import type { RouteRecordRaw } from 'vue-router'
import type { App } from 'vue'
export const routes: AppRouteRecordRaw[] = []
createRouter({
const router = createRouter({
history: createWebHashHistory(),
routes: routes as RouteRecordRaw[]
})
const fn = () => {
console.log('push')
}
const router = {
install: () => {
console.log('install')
},
currentRoute: fn,
listening: true,
addRoute: fn,
removeRoute: fn,
hasRoute: fn,
getRoutes: fn,
resolve: fn,
options: fn,
push: fn,
replace: fn,
go: fn,
back: fn,
forward: fn
const rawInstall = router.install
router.install = app => {
const hash = window.location.hash
console.log('hash', hash)
rawInstall(app)
console.log('hash1', window.location.hash)
setTimeout(() => {
console.log('hash2', window.location.hash)
}, 300)
window.location.hash = hash
console.log('hash3', window.location.hash)
}
export const setupRouter = (app: App<Element>) => {