import Vue from "vue"; import Router from "vue-router"; import Home from "./views/Home.vue"; import NotFound from "./views/404.vue"; import login from "./modules/login/router"; // module-example import base from "./modules/base/router"; import exam from "./modules/exam/router"; import print from "./modules/print/router"; import customer from "./modules/customer/router"; // card part import card from "./modules/card/router"; // admin import admin from "./modules/admin/router"; // ignore NavigationDuplicated. https://github.com/vuejs/vue-router/issues/2881 const originalPush = Router.prototype.push; Router.prototype.push = function push(location, onResolve, onReject) { if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject); try { return originalPush.call(this, location).catch(err => err); } catch (error) { console.log(error); } }; // end ignore Vue.use(Router); export default new Router({ routes: [ { path: "/", name: "Index", redirect: { name: "Login" } }, { path: "/home", name: "Home", component: Home, children: [...base, ...exam, ...print, ...customer] }, { ...login }, { ...admin }, ...card, { path: "*", name: "404", component: NotFound } // [lazy-loaded] route level code-splitting // { // path: "/about", // name: "about", // // this generates a separate chunk (about.[hash].js) for this route // // which is lazy-loaded when the route is visited. // component: () => // import(/* webpackChunkName: "about" */ "./views/About.vue") // } ] });