Files
gangyan/chat_web_front/src/router/index.ts

80 lines
1.8 KiB
TypeScript

import type { App } from 'vue'
import type { RouteRecordRaw } from 'vue-router'
import { createRouter, createWebHashHistory } from 'vue-router'
import { setupPageGuard } from './permission'
const routes: RouteRecordRaw[] = [
{
path: '/',
name: '/',
redirect: '/chat'
},
{
path: '/login',
name: 'Login',
component: () => import('@/views/login/index.vue'),
},
{
path: '/chat',
name: 'Chat',
component: () => import('@/views/chat/index.vue'),
},
{
path: '/writing',
name: 'Documents',
component: () => import('@/views/writing/index.vue'),
},
{
path: '/writing/edit',
name: 'DocWriting',
component: () => import('@/views/writing/DocWriting.vue'),
},
{
path: '/knowledgeBase',
name: 'KnowledgeBase',
component: () => import('@/views/reading/index.vue'),
},
{
path: '/knowledgeBase/fileList',
name: 'FileList',
component: () => import('@/views/reading/fileList.vue'),
},
{
path: '/knowledgeBase/fileDetail',
name: 'FileDetail',
component: () => import('@/views/reading/fileDetail.vue'),
},
{
path: '/applications',
name: 'Application',
component: () => import('@/views/applications/index.vue'),
},
{
path: '/translate',
name: 'Translate',
component: () => import('@/views/translate/index.vue'),
},
{
path: '/translate/history',
name: 'TranslateHistory',
component: () => import('@/views/translate/history.vue'),
},
{
path: '/translate/result',
name: 'TranslateResult',
component: () => import('@/views/translate/result.vue'),
},
]
export const router = createRouter({
history: createWebHashHistory(),
routes,
// scrollBehavior: () => ({ left: 0, top: 0 }),
})
setupPageGuard(router)
export async function setupRouter(app: App) {
app.use(router)
await router.isReady()
}