123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import Vue from 'vue'
- import VueRouter from 'vue-router'
- Vue.use(VueRouter)
- const originalPush = VueRouter.prototype.push
- VueRouter.prototype.push = function push(location) {
- return originalPush.call(this, location).catch(err => err)
- }
- const routes = [
- {
- path: "/",
- component: () => import('@/views/index'),
- },
- // {
- // path:'/login',
- // name:'Login',
- // meta: {
- // title: '系统登录'
- // },
- // component: () => import("@/views/login/index.vue")
- // },
- {
- path: "",
- component: () => import('@/views/layout/index.vue'),
- children: [
- {
- path: '/home',
- name: 'Home',
- meta: {
- // title: '首页',
- sign: 'home',
- belong: 'home'
- },
- component: () => import('@/views/home/index.vue'),
- },
- ]
- }
-
- ]
- const router = new VueRouter({
- mode: 'history',
- base: '/',
- routes
- })
- router.beforeEach((to, from, next) => {
- if (to.meta.title) {
- document.title = to.meta.title;
- }
- next();
- })
- router.afterEach((to, from) => {
- });
- export default router
|