refactor(router): 调整首页路由指向班级页面

- 将首页路由组件由Index改为Class
- 修改首页路由的meta标题为“班级”
- 删除原有的/class路由配置
- 更新Header组件中“班级”链接指向根路径
- 修改全局路由守卫处理页面标题格式为“标题 - Enlish”
This commit is contained in:
lbw
2025-12-15 11:22:18 +08:00
parent eb2c0d2f6c
commit e5a1ef1423
3 changed files with 4 additions and 11 deletions

View File

@@ -39,7 +39,7 @@
</li> </li>
<li> <li>
<router-link <router-link
to="/class" to="/"
class="block py-2 pr-4 pl-3 text-gray-700 border-b border-gray-100 hover:bg-gray-50 lg:hover:bg-transparent lg:border-0 lg:hover:text-primary-700 lg:p-0 dark:text-gray-400 lg:dark:hover:text-white dark:hover:bg-gray-700 dark:hover:text-white lg:dark:hover:bg-transparent dark:border-gray-700"> class="block py-2 pr-4 pl-3 text-gray-700 border-b border-gray-100 hover:bg-gray-50 lg:hover:bg-transparent lg:border-0 lg:hover:text-primary-700 lg:p-0 dark:text-gray-400 lg:dark:hover:text-white dark:hover:bg-gray-700 dark:hover:text-white lg:dark:hover:bg-transparent dark:border-gray-700">
班级 班级
</router-link> </router-link>

View File

@@ -14,7 +14,7 @@ router.beforeEach((to, from, next) => {
// 全局路由后置守卫 // 全局路由后置守卫
router.afterEach((to, from) => { router.afterEach((to, from) => {
// 动态设置页面 Title // 动态设置页面 Title
let title = (to.meta.title ? to.meta.title : '') + ' - Weblog' let title = (to.meta.title ? to.meta.title : '') + ' - Enlish'
document.title = title document.title = title
// 隐藏页面加载 Loading // 隐藏页面加载 Loading

View File

@@ -7,9 +7,9 @@ import { createRouter, createWebHashHistory } from 'vue-router'
const routes = [ const routes = [
{ {
path: '/', // 路由地址 path: '/', // 路由地址
component: Index, // 对应组件 component: Class, // 对应组件
meta: { // meta 信息 meta: { // meta 信息
title: '首页' // 页面标题 title: '班级' // 页面标题
} }
}, },
{ {
@@ -18,13 +18,6 @@ const routes = [
meta: { // meta 信息 meta: { // meta 信息
title: '上传图片' // 页面标题 title: '上传图片' // 页面标题
} }
},
{
path: '/class', // 路由地址
component: Class, // 对应组件
meta: { // meta 信息
title: '班级' // 页面标题
}
} }
] ]