mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-18 01:06:39 +08:00
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
import {createRouter, createWebHashHistory} from 'vue-router'
|
|
import {createApp} from 'vue'
|
|
import ElementPlus from "element-plus"
|
|
import "element-plus/dist/index.css"
|
|
import App from './App.vue'
|
|
import ChatPlus from "@/views/ChatPlus.vue";
|
|
import NotFound from './views/404.vue'
|
|
import TestPage from './views/Test.vue'
|
|
import './utils/prototype'
|
|
|
|
const routes = [
|
|
{
|
|
name: 'chat-plus', path: '/', component: ChatPlus, meta: {
|
|
title: 'ChatGPT-Plus'
|
|
}
|
|
},
|
|
{
|
|
name: 'test', path: '/test', component: TestPage, meta: {
|
|
title: '测试页面'
|
|
}
|
|
},
|
|
{
|
|
name: 'NotFound', path: '/:all(.*)', component: NotFound, meta: {
|
|
title: '页面没有找到'
|
|
}
|
|
},
|
|
]
|
|
|
|
const router = createRouter({
|
|
history: createWebHashHistory(),
|
|
routes: routes,
|
|
})
|
|
|
|
// dynamic change the title when router change
|
|
router.beforeEach((to, from, next) => {
|
|
if (to.meta.title) {
|
|
document.title = to.meta.title
|
|
}
|
|
next()
|
|
})
|
|
|
|
const app = createApp(App)
|
|
app.use(router).use(ElementPlus).mount('#app')
|
|
|
|
|