import Vue from 'vue' import Router from 'vue-router' Vue.use(Router) const routes = [ { path: '/', redirect: '/pages/home/index' }, { path: '/pages/home/index', name: 'Home', component: () => import('@/pages/home/index') }, { path: '/pages/novel/list', name: 'NovelList', component: () => import('@/pages/novel/list') }, { path: '/pages/novel/reader', name: 'NovelReader', component: () => import('@/pages/novel/reader'), props: route => ({ novelId: route.query.novelId, chapterId: route.query.chapterId }) }, { path: '/pages/author/apply', name: 'AuthorApply', component: () => import('@/pages/author/apply') }, { path: '/pages/search/index', name: 'Search', component: () => import('@/pages/search/index') }, { path: '/pages/book/list', name: 'BookList', component: () => import('@/pages/book/list') }, { path: '/bookshelf', component: () => import('@/views/bookshelf'), meta: { requiresAuth: true } // 需要登录 }, { path: '/mine', component: () => import('@/views/mine'), meta: { requiresAuth: true } // 需要登录 }, { path: '/', component: () => import('@/views/home'), meta: { requiresAuth: false } // 不需要登录 } ] export default new VueRouter({ mode: 'history', base: process.env.BASE_URL, routes })