123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- import Vue from 'vue'
- import VueRouter from 'vue-router'
- import Layout from '@/layout'
- import Backstage from '@/backstage'
- import ParentView from '@/components/ParentView'
- //路由报错处理
- Vue.use(VueRouter)
- const originalPush = VueRouter.prototype.push
- VueRouter.prototype.push = function push(location) {
- return originalPush.call(this, location).catch((err) => err)
- }
- const originalReplace = VueRouter.prototype.replace
- VueRouter.prototype.replace = function replace(location) {
- return originalReplace.call(this, location).catch((err) => err)
- }
- const routes = [
- {
- path: '/',
- component: Layout,
- redirect: '/home',
- // name: 'gf',
- children: [
- {
- path: 'home',
- component: () => import('@/views/home/index'),
- meta: { title: '首页', icon: '', affix: true }
- },
- {
- path: 'menuList',
- component: () => import('@/views/menuList/index'),
- meta: { title: '其他', icon: '', affix: true }
- },
- {
- path: 'info',
- component: () => import('@/views/info/index'),
- meta: { title: '文章详情', icon: '', affix: true }
- },
- {
- path: 'searchKey',
- component: () => import('@/views/searchKey/index'),
- meta: { title: '搜索页', icon: '', affix: true }
- },
- {
- path: 'contribute',
- component: () => import('@/views/contribute/index'),
- meta: { title: '投稿中心', icon: '', affix: true }
- },
- {
- path: 'certsearch',
- component: () => import('@/views/certsearch/index'),
- meta: { title: '证书查询', icon: '', affix: true }
- },
- {
- path: 'problem',
- component: () => import('@/views/problem/index'),
- meta: { title: '常见问题', icon: '', affix: true }
- },
- ]
- },
- // {
- // path: '/System',
- // component: Backstage,
- // redirect: '/System/home',
- // // name: 'gf',
- // children: [
- // {
- // path: '/System/home',
- // component: () => import('@/views/System/home/index'),
- // meta: { title: '工作台', icon: '', affix: true }
- // },
- // {
- // path: '/System/setting',
- // redirect: '/System/setting/menu',
- // component: ParentView,
- // meta: { title: '栏目设置', icon: '', affix: true },
- // children: [
- // {
- // path: '/System/setting/websiteMenu',
- // component: () => import('@/views/System/setting/websiteMenu/index'),
- // meta: { title: '官网菜单设置', icon: '', affix: true }
- // },
- // {
- // path: '/System/setting/menu',
- // component: () => import('@/views/System/setting/menu/index'),
- // meta: { title: '后台菜单设置', icon: '', affix: true }
- // }
- // ]
- // }
- // ]
- // },
- {
- path: '/login',
- name: 'login',
- component: () => import('@/views/login/index'),
- meta: { title: '登录页', icon: '', affix: true },
- hidden: true
- },
- {
- path: '/404',
- name: 'error',
- component: () => import('@/views/404'),
- hidden: true
- }
- ]
- const router = new VueRouter({
- mode: 'history', // 去掉url中的#
- scrollBehavior: () => ({ y: 0 }),
- routes
- })
- export default router
|