feat: 重构插件安装方式,统一使用 install 方法并移除不必要的 setup 函数
All checks were successful
/ playwright (push) Successful in 2m19s
/ build-and-deploy-to-vercel (push) Successful in 1m9s
/ depcheck (push) Successful in 1m5s

This commit is contained in:
严浩
2024-12-24 23:13:09 +08:00
parent e9f5aa56a6
commit 9d421c5bfe
7 changed files with 39 additions and 40 deletions

View File

@ -14,14 +14,14 @@ router.onError((error) => {
console.debug('🚨 [router error]: ', error);
});
function setupRouter(app: import('vue').App) {
export { router };
export function install({ app }: { app: import('vue').App<Element> }) {
app
// Register the plugin before the router
.use(DataLoaderPlugin, { router })
// adding the router will trigger the initial navigation
.use(router);
}
export { router, setupRouter };
// ========================================================================
// =========================== Router Guards ==============================
// ========================================================================