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); } export default new VueRouter({ routes: [{ path: '/', // 程序启动默认路由 component: () => import('@/components/common/Whole.vue'), meta: { title: '整体页面布局' }, redirect: '/test1', // 重定向到首页 children: [ // { // path: '/Home', // component: () => import('@/page/Home.vue'), // meta: { title: '首页' } // }, { path: '/test1', component: () => import('@/page/test1/index.vue'), meta: { title: '一级菜单1' }, redirect: '/test1/AnalysisMain', // 该配置是若点击选择一级菜单时,默认选中并跳转到该一级菜单下的第一个二级菜单 children:[ { path: 'test1-1', component: () => import('@/page/test1/test1-1.vue'), meta: { title: '二级菜单1-1' }, }, { path: 'test1-2', component: () => import('@/page/test1/test1-2.vue'), meta: { title: '二级菜单1-2' }, }, { path: 'test1-3', component: () => import('@/page/test1/test1-3.vue'), meta: { title: '二级菜单1-3' }, }, { path: 'test1-4', component: () => import('@/page/test1/test1-4.vue'), meta: { title: '二级菜单1-4' }, }, { path: 'test1-5', component: () => import('@/page/test1/test1-5.vue'), meta: { title: '二级菜单1-5' }, }, { path: 'AnalysisMain', meta: { title: '分析' ,icon:'ac'}, component: () => import ('@/views/AnalysisMain.vue') }, { path: 'index', meta: { title: '分析' }, component: () => import ('@/views/index.vue') }, { path: 'AboutMachine', name: 'AboutMachine', meta: { title: '关于本机' }, component: () => import ('@/views/general/AboutMachine.vue'), }, { path: 'network', name: 'network', meta: { title: '网络' }, component: () => import ('@/views/general/network.vue'), }, { path: 'VPN', name: 'VPN', meta: { title: 'VPN' }, component: () => import ('@/views/general/VPN.vue'), }, { path: 'CustomOperations', name: 'CustomOperations', meta: { title: '自定义操作' }, component: () => import ('@/views/general/CustomOperations.vue'), }, { path: 'HealthCheck', name: 'HealthCheck', meta: { title: '健康检测' }, component: () => import ('@/views/general/HealthCheck.vue'), }, { path: 'AboutMachine', name: 'AboutMachine', meta: { title: '关于本机' }, component: () => import('@/views/general/AboutMachine.vue'), }, { path: 'network', name: 'network', meta: { title: '网络' }, component: () => import('@/views/general/network.vue'), }, { path: 'VPN', name: 'VPN', meta: { title: 'VPN' }, component: () => import('@/views/general/VPN.vue'), }, { path: 'CustomOperations', name: 'CustomOperations', meta: { title: '自定义操作' }, component: () => import('@/views/general/CustomOperations.vue'), }, { path: 'HealthCheck', name: 'HealthCheck', meta: { title: '健康检测' }, component: () => import('@/views/general/HealthCheck.vue'), }, { path: 'StateOperation', name: 'StateOperation', meta: { title: '运行状态' }, component: () => import('@/views/StateOperation.vue'), }, { path: 'interface', name: 'interface', meta: { title: '接口' }, component: () => import('@/views/interface.vue'), }, { path: 'IPSetting', name: 'IPSetting', meta: { title: 'IP设置' }, component: () => import('@/views/IPSetting.vue'), }, { path: 'globalSettings', name: 'globalSettings', meta: { title: '全局设置' }, component: () => import('@/views/SystemSettings/globalSettings.vue'), }, { path: 'ExportingSettings', name: 'ExportingSettings', meta: { title: '关于本机——导出设置' }, component: () => import('@/views/SystemSettings/ExportingSettings.vue'), }, { path: 'ImportSettings', name: 'ImportSettings', meta: { title: '关于本机——导入设置' }, component: () => import('@/views/SystemSettings/ImportSettings.vue'), }, { path: 'InterfaceServerCertificates', name: 'InterfaceServerCertificates', meta: { title: '接口与服务器证书' }, component: () => import('@/views/SystemSettings/InterfaceServerCertificates.vue'), }, { path: 'UDPServiceSettings', name: 'UDPServiceSettings', meta: { title: 'UDP服务设置' }, component: () => import('@/views/SystemSettings/UDPServiceSettings.vue'), }, { path: 'myId', name: 'myId', meta: { title: '我的账号' }, component: () => import('@/views/myId.vue'), }, { path: 'IdManagement', name: 'IdManagement', meta: { title: '账号管理' }, component: () => import('@/views/IdManagement.vue'), }, { path: 'logs', name: 'logs', meta: { title: '通知/日志' }, component: () => import('@/views/logs.vue') } ] }, { path: '/test2', component: () => import('@/page/test2/index.vue'), meta: { title: '一级菜单2' }, redirect: '/test2/test2-1', // 该配置是若点击选择父目录时,默认选中该父目录下的子路径页面 children: [{ path: 'test2-1', component: () => import('@/page/test2/test2-1.vue'), meta: { title: '二级菜单2-1' }, }, { path: 'test2-2', component: () => import('@/page/test2/test2-2.vue'), meta: { title: '二级菜单2-2' }, }, { path: 'test2-3', component: () => import('@/page/test2/test2-3.vue'), meta: { title: '二级菜单2-3' }, }, ] }, { path: '/test3', component: () => import('@/page/test3/index.vue'), meta: { title: '一级菜单3' }, redirect: '/test3/test3-1', children: [{ path: 'test3-1', component: () => import('@/page/test3/test3-1.vue'), meta: { title: '二级菜单3-1' } }, { path: 'test3-2', component: () => import('@/page/test3/test3-2.vue'), meta: { title: '二级菜单3-2' } }, ] }, { path: '/i18n', // 国际化组件 component: () => import('@/components/common/I18n.vue'), meta: { title: '国际化' } }, { path: '/permission', // 权限页面 component: () => import('@/page/Permission.vue'), meta: { title: '权限测试', permission: true } }, { path: '/404', component: () => import('@/page/404.vue'), meta: { title: '404' } }, { path: '/403', component: () => import('@/page/403.vue'), meta: { title: '403' } }, ] }, { path: '/Login', // 登录页面 component: () => import('@/page/Login.vue'), meta: { title: '登录' } }, { path: '*', redirect: '/404' } ] });