mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-12-27 02:25:58 +08:00
完成前后端框架搭建,完成聊天页面布局
This commit is contained in:
40
web/src/main.js
Normal file
40
web/src/main.js
Normal file
@@ -0,0 +1,40 @@
|
||||
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 Home from './views/Chat.vue'
|
||||
import NotFound from './views/404.vue'
|
||||
import './utils/prototype'
|
||||
|
||||
|
||||
const routes = [
|
||||
{
|
||||
name: 'home', path: '/', component: Home, meta: {
|
||||
title: 'ChatGPT-Console'
|
||||
}
|
||||
},
|
||||
{
|
||||
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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user