修改封装删除路由并重新push
This commit is contained in:
@@ -10,9 +10,15 @@ Router.prototype.push = function push(location, onResolve, onReject) {
|
||||
return originalPush.call(this, location).catch(err => err)
|
||||
}
|
||||
|
||||
export default new Router({
|
||||
const createRouter = ()=> new Router({
|
||||
mode: 'history',
|
||||
base: process.env.BASE_URL,
|
||||
scrollBehavior: () => ({ y: 0 }),
|
||||
routes: constantRouterMap
|
||||
})
|
||||
})
|
||||
const router = createRouter()
|
||||
export function resetRouter () {
|
||||
const newRouter = createRouter()
|
||||
router.matcher = newRouter.matcher // reset router
|
||||
}
|
||||
export default router
|
||||
Reference in New Issue
Block a user