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: '/applications', name: 'Application', component: () => import('@/views/applications/index.vue'), }, { path: '/profile', name: 'Profile', component: () => import('@/views/profile/index.vue'), }, { path: '/userManage', name: 'UserManage', component: () => import('@/views/userManage/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() }