import { createRouter, createWebHashHistory } from 'vue-router' import Utils from "@/utils/utils"; const router = createRouter({ history: createWebHashHistory(), routes: [ { path: '/', redirect: '/chat' }, { path: '/chat', name: 'chat', component: () => import('../views/chat.vue'), meta: { keepAlive: true, title: '小蓝管家' } }, { path: '/word', name: 'word', component: () => import('../views/word.vue'), meta: { keepAlive: true, title: '小蓝管家' } }, // { // path: '/history', // name: 'history', // component: () => import('../views/history.vue'), // meta: { title: '小蓝管家-历史记录查询' }, // }, // { // path: '/previewPdf', // name: 'previewPdf', // component: () => import('../components/previewPDF/index.vue'), // meta: { title: '预览PDF' }, // }, ], }) const defaultTitle = '小蓝管家' // 全局前置路由守卫 router.beforeEach(async (to, from, next) => { /* 路由发生变化修改页面title */ var title = to.meta.title ? to.meta.title : defaultTitle; Utils.setTitle(title);//修改页面title next(); }) export default router