diff --git a/packages/fineui/src/core/4.widget.js b/packages/fineui/src/core/4.widget.js index c8fbe5d2f..df12ef774 100644 --- a/packages/fineui/src/core/4.widget.js +++ b/packages/fineui/src/core/4.widget.js @@ -241,7 +241,7 @@ export class Widget extends OB { if (beforeRenderResult instanceof Promise) { beforeRenderResult.then(render).catch((e) => { _global.console && console.error(e); - render(); + !this.isDestroyed() && render(); // 异步render,改组件此时可能已经被销毁 }); } } else { @@ -258,7 +258,7 @@ export class Widget extends OB { if (beforeInitResult instanceof Promise) { beforeInitResult.then(init).catch((e) => { _global.console && console.error(e); - init(); + !this.isDestroyed() && init(); // 异步render,改组件此时可能已经被销毁 }); } } else { diff --git a/packages/fineui/src/core/platform/web/detectElementResize.js b/packages/fineui/src/core/platform/web/detectElementResize.js index 3ae28a853..47e360114 100644 --- a/packages/fineui/src/core/platform/web/detectElementResize.js +++ b/packages/fineui/src/core/platform/web/detectElementResize.js @@ -46,10 +46,14 @@ export const ResizeDetector = { addResizeListener(widget.element[0], fn); return function () { + // 如果fn是debounce需要cancel掉 + fn?.cancel?.(); removeResizeListener(widget.element[0], fn); }; }, removeResizeListener(widget, fn) { + // 如果fn是debounce需要cancel掉 + fn?.cancel?.(); removeResizeListener(widget.element[0], fn); }, }; diff --git a/packages/fineui/src/core/wrapper/layout/layout.table.js b/packages/fineui/src/core/wrapper/layout/layout.table.js index ec75bc8f0..b32f9b530 100644 --- a/packages/fineui/src/core/wrapper/layout/layout.table.js +++ b/packages/fineui/src/core/wrapper/layout/layout.table.js @@ -56,10 +56,10 @@ export class TableLayout extends Layout { "grid-column-gap": this._optimiseGap(o.hgap), }); } - + return { type: "bi.default", - ref(_ref) { + ref: (_ref) => { this.layout = _ref; }, items: this._formatItems(items), @@ -110,7 +110,7 @@ export class TableLayout extends Layout { type: "bi.layout", }), cls); } - + return first(wrapLayout(item), cls); })), []); } diff --git a/packages/fineui/src/fix/fix.js b/packages/fineui/src/fix/fix.js index c2f0ddd12..387eb3984 100644 --- a/packages/fineui/src/fix/fix.js +++ b/packages/fineui/src/fix/fix.js @@ -1386,7 +1386,7 @@ class Model { this.$$computed = null; this.$$state = null; this.$$context = null; - this.model = null; + this.model = {}; // 一些异步请求里访问model里的属性,这里先变成空对象,保证部分场景下不报错,其他报错会try catch this._destroyHandler && this._destroyHandler(); } }