180 lines
5.6 KiB
JavaScript
180 lines
5.6 KiB
JavaScript
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/test1-1', // 该配置是若点击选择一级菜单时,默认选中并跳转到该一级菜单下的第一个二级菜单
|
|
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: '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: '/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'
|
|
}
|
|
]
|
|
}); |