// src/router/index.js import Vue from 'vue' import Router from 'vue-router' import Layout from '@/layout' Vue.use(Router) export default new Router({ mode: 'history', base: process.env.BASE_URL, routes: [ { path: '/', component: Layout, redirect: '/dashboard', children: [ { path: 'dashboard', component: () => import('@/views/dashboard/index'), name: 'Dashboard', meta: { title: '首页', icon: 'dashboard' } } ] }, // 添加搜索路由 { path: '/search', component: Layout, hidden: true, children: [ { path: 'index', component: () => import('@/views/search/index'), name: 'Search', meta: { title: '搜索' } } ] }, // 确保所有页面都有正确的路由配置 { path: '/login', component: () => import('@/views/login/index'), hidden: true } ] }) // 在路由配置中添加懒加载 { path: '/novel/list', component: () => import(/* webpackChunkName: "novel-list" */ '@/views/novel/list.vue') }