feat: 更新 index.html 和样式文件,优化样式导入和结构
Some checks failed
/ build-and-deploy-to-vercel (push) Successful in 1m34s
/ depcheck (push) Successful in 1m28s
/ playwright (push) Failing after 3m25s

This commit is contained in:
严浩
2024-12-23 10:44:47 +08:00
parent 4037060842
commit de9260dcf5
7 changed files with 19 additions and 74 deletions

View File

@ -0,0 +1,32 @@
import { DataLoaderPlugin } from 'unplugin-vue-router/data-loaders';
import { createRouter, createWebHistory } from 'vue-router';
import { handleHotUpdate, routes } from 'vue-router/auto-routes';
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 });
function setupRouter(app: import('vue').App) {
app
.use(DataLoaderPlugin, { router }) // Register the plugin before the router
.use(router); // adding the router will trigger the initial navigation
}
export { router, setupRouter };
// ========================================================================
// =========================== Router Guards ==============================
// ========================================================================
{
// 警告:路由守卫的创建顺序会影响执行流程,请勿调整
createNProgressGuard(router);
createLogGuard(router);
Object.assign(window, { stack: createStackGuard(router) });
}