feat: 添加NProgress加载进度条和优化UI样式

添加NProgress依赖并集成到路由中,实现页面切换时的加载进度条
优化友链页面、博客分类和文章列表的UI样式
调整登录按钮和图片懒加载的显示效果
新增标签随机颜色功能,提升视觉体验
This commit is contained in:
2026-01-15 17:17:40 +08:00
parent d00c18d38a
commit ac4f8dac82
17 changed files with 204 additions and 73 deletions

View File

@ -1,6 +1,6 @@
import NProgress from 'nprogress';
import { createRouter, createWebHistory } from "vue-router";
import { routes } from 'vue-router/auto-routes';
import { routes } from "vue-router/auto-routes";
routes.unshift({
path: "/",
redirect: "/home",
@ -8,7 +8,17 @@ routes.unshift({
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes:routes as any
routes: routes as any,
});
// 前置守卫
router.beforeEach((to, from, next) => {
NProgress.start()
next();
});
// 后置守卫
router.afterEach(() => {
NProgress.done()
});
export default router;