1234567891011121314151617181920212223242526 |
- import Vue from "vue";
- import VueRouter from "vue-router";
- import hhr from "./hhr";
- Vue.use(VueRouter);
-
- const routes = [...hhr];
-
- const router = new VueRouter({
- mode: "history",
- base: "web",
- routes,
- });
-
- router.beforeEach((to, from, next) => {
- /* 路由发生变化修改页面title */
- if (to.meta.title) {
- document.title = to.meta.title;
- }
- });
-
- const originalPush = VueRouter.prototype.push;
- VueRouter.prototype.push = function push(location) {
- return originalPush.call(this, location).catch(err => err);
- };
-
- export default router;
|