Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(ui): handle dynamic import in renderVue3Component with try-catch due to esbuild limitations (#1518)

白熱a684e9d1abf2
diff --git a/packages/ui/src/common/component-manager.ts b/packages/ui/src/common/component-manager.ts
index cb4705408d..52419c8a97 100644
--- a/packages/ui/src/common/component-manager.ts
+++ b/packages/ui/src/common/component-manager.ts
@@ -271,15 +271,18 @@ export class ComponentManager {
}
async function renderVue3Component(VueComponent: ReturnType<typeof defineComponent>, element: HTMLElement, args: Record<string, any>) {
- const { h, render } = await import('vue');
+ try {
+ const { h, render } = await import('vue');
- const vnode = h(VueComponent, args);
+ const vnode = h(VueComponent, args);
- const container = document.createElement('div');
+ const container = document.createElement('div');
- document.body.appendChild(container);
+ document.body.appendChild(container);
- render(vnode, element);
+ render(vnode, element);
+ } catch (error) {
+ }
}
export function VueComponentWrapper(options: { component: ReturnType<typeof defineComponent>; props: Record<string, any> }) {