完成前后端框架搭建,完成聊天页面布局

This commit is contained in:
RockYang
2023-03-17 14:17:27 +08:00
commit c25cc97450
35 changed files with 21044 additions and 0 deletions

40
web/src/main.js Normal file
View 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')