12 lines
387 B
Plaintext
12 lines
387 B
Plaintext
//返回首页时清空路由
|
|
import router from '@/router'
|
|
import { constantRoutes } from '@/router'
|
|
import Router from 'vue-router'
|
|
export function resetRouter() {
|
|
const newRouter = new Router({
|
|
mode: 'hash', //
|
|
scrollBehavior: () => ({ y: 0 }),
|
|
routes: constantRoutes, //引入的公共路由
|
|
});
|
|
router.matcher = newRouter.matcher; // reset router
|
|
} |