leiyanting

导航

 
import Vue from 'vue'
import VueRouter from 'vue-router'

// 解决router点击重复路由报错
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

// 主页页面
import Home from '../views/Main/Home/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    redirect:'/home'
  },
  {
    path: '/home',
    component: Home
  },
  {
    // 借阅页面
    path: '/borrowing',
    component: resolve=>(require(["../views/Main/Borrowing/Borrowing.vue"],resolve))
  },
  // 管理页面引入
  {
    path: '/management',
    component: resolve=>(require(["../views/Main/Management/Management.vue"],resolve))
  },
  // 引入资料检索页面
  {
    path: '/retrieve',
    component: resolve=>(require(["../views/Main/Retrieve/Retrieve.vue"],resolve))
  },
  // 引入统计分析页面
  {
    path: '/statistical',
    component: resolve=>(require(["../views/Main/Statistical/Statistical.vue"],resolve))
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router

 

posted on 2022-02-24 09:17  leiyanting  阅读(64)  评论(0编辑  收藏  举报