feat: 重构 PrimeVue 相关插件,优化对话框和通知服务的使用,更新样式和组件结构
All checks were successful
/ depcheck (push) Successful in 1m37s
/ build-and-deploy-to-vercel (push) Successful in 1m37s
/ playwright (push) Successful in 1m56s

This commit is contained in:
严浩
2024-12-15 18:45:27 +08:00
parent 0be091c32f
commit 86d0e5622d
9 changed files with 158 additions and 97 deletions

28
src/plugins/router.ts Normal file
View File

@ -0,0 +1,28 @@
import { DataLoaderPlugin } from 'unplugin-vue-router/data-loaders';
import { createLogGuard, createProgressGuard, createStackGuard } from 'utils4u/vue-router';
import { createRouter, createWebHistory } from 'vue-router';
import { handleHotUpdate, routes } from 'vue-router/auto-routes';
export const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes,
strict: true,
});
router.onError((error) => {
console.debug('🚨 [router error]: ', error);
});
if (import.meta.hot) handleHotUpdate(router);
if ($__DEV__) Object.assign(window, { router });
export function setupRouter(app: import('vue').App) {
app
// Register the plugin before the router
.use(DataLoaderPlugin, { router })
// adding the router will trigger the initial navigation
.use(router);
// 警告:路由守卫的创建顺序会影响执行流程,请勿调整
createProgressGuard(router);
createLogGuard(router);
Object.assign(window, { stack: createStackGuard(router) });
}