import Vue from "vue" import Router from "vue-router" import routers from "./router/index" Vue.use(Router) const centerChildrenRouter: any[] = [] Object.values(routers).forEach((route: any) => { if (!route) { return } centerChildrenRouter.push(...route) }) const routes: any[] = [ { path: "/", name: "/", redirect: "/home", component: () => import(/* webpackChunkName: 'center' */ "@/views/home/home.vue"), children: centerChildrenRouter, }, ] // 404 const router = new Router({ mode: 'history', base: "/", routes, }) // 入驻处理 // async function hasHousedHandle(next: any) { // next() // } // 全局导卫 router.beforeEach((to: any, from: any, next: any) => { next() }) export default router