fix: 解决window.xxx在路由报错情况下的undefined问题

This commit is contained in:
dap
2026-03-23 11:38:51 +08:00
parent 46e8d50d40
commit 3a2d051992
3 changed files with 43 additions and 13 deletions

View File

@@ -17,6 +17,7 @@ import { initComponentAdapter } from './adapter/component';
import { initSetupVbenForm } from './adapter/form';
import App from './app.vue';
import { router } from './router';
import { initPopupContext } from './utils/context';
async function bootstrap(namespace: string) {
// 初始化组件适配器
@@ -58,6 +59,9 @@ async function bootstrap(namespace: string) {
const { initTippy } = await import('@vben/common-ui/es/tippy');
initTippy(app);
// 初始化全局弹窗方法(静态API fallback, 防止路由守卫中访问undefined)
initPopupContext();
// 配置路由及路由守卫
app.use(router);