Files
AI-Bill/apps/frontend/src/router/index.ts

68 lines
1.7 KiB
TypeScript
Raw Normal View History

2025-11-01 09:24:26 +08:00
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router';
const routes: RouteRecordRaw[] = [
{
path: '/',
name: 'dashboard',
component: () => import('../features/dashboard/pages/DashboardPage.vue'),
meta: { title: '仪表盘' }
},
{
path: '/transactions',
name: 'transactions',
component: () => import('../features/transactions/pages/TransactionsPage.vue'),
meta: { title: '交易记录' }
},
{
path: '/analysis',
name: 'analysis',
component: () => import('../features/analysis/pages/AnalysisPage.vue'),
meta: { title: 'AI 智能分析' }
},
{
path: '/settings',
name: 'settings',
component: () => import('../features/settings/pages/SettingsPage.vue'),
meta: { title: '设置' }
},
{
path: '/auth',
component: () => import('../features/auth/pages/AuthLayout.vue'),
children: [
{
path: 'login',
name: 'login',
component: () => import('../features/auth/pages/LoginPage.vue'),
meta: { title: '登录' }
},
{
path: 'register',
name: 'register',
component: () => import('../features/auth/pages/RegisterPage.vue'),
meta: { title: '注册' }
},
{
path: 'forgot-password',
name: 'forgot-password',
component: () => import('../features/auth/pages/ForgotPasswordPage.vue'),
meta: { title: '找回密码' }
}
]
}
];
const router = createRouter({
history: createWebHistory(),
routes
});
router.afterEach((to) => {
if (to.meta.title) {
document.title = `AI 记账 · ${to.meta.title}`;
} else {
document.title = 'AI 记账';
}
});
export default router;