Browse Source

Pull request #3708: KERNEL-16950 fix: 优化

Merge in VISUAL/fineui from ~IMP/fineui_fui:master to master

* commit '4b443685e985c951eb76853a2e80b855863be745':
  KERNEL-16950 fix: ref
  KERNEL-16950 fix: 优化
  KERNEL-16950 fix: 优化
research/test
imp-张健 11 months ago
parent
commit
9933c2e950
  1. 4
      packages/fineui/src/core/4.widget.js
  2. 4
      packages/fineui/src/core/platform/web/detectElementResize.js
  3. 2
      packages/fineui/src/core/wrapper/layout/layout.table.js
  4. 2
      packages/fineui/src/fix/fix.js

4
packages/fineui/src/core/4.widget.js

@ -241,7 +241,7 @@ export class Widget extends OB {
if (beforeRenderResult instanceof Promise) { if (beforeRenderResult instanceof Promise) {
beforeRenderResult.then(render).catch((e) => { beforeRenderResult.then(render).catch((e) => {
_global.console && console.error(e); _global.console && console.error(e);
render(); !this.isDestroyed() && render(); // 异步render,改组件此时可能已经被销毁
}); });
} }
} else { } else {
@ -258,7 +258,7 @@ export class Widget extends OB {
if (beforeInitResult instanceof Promise) { if (beforeInitResult instanceof Promise) {
beforeInitResult.then(init).catch((e) => { beforeInitResult.then(init).catch((e) => {
_global.console && console.error(e); _global.console && console.error(e);
init(); !this.isDestroyed() && init(); // 异步render,改组件此时可能已经被销毁
}); });
} }
} else { } else {

4
packages/fineui/src/core/platform/web/detectElementResize.js

@ -46,10 +46,14 @@ export const ResizeDetector = {
addResizeListener(widget.element[0], fn); addResizeListener(widget.element[0], fn);
return function () { return function () {
// 如果fn是debounce需要cancel掉
fn?.cancel?.();
removeResizeListener(widget.element[0], fn); removeResizeListener(widget.element[0], fn);
}; };
}, },
removeResizeListener(widget, fn) { removeResizeListener(widget, fn) {
// 如果fn是debounce需要cancel掉
fn?.cancel?.();
removeResizeListener(widget.element[0], fn); removeResizeListener(widget.element[0], fn);
}, },
}; };

2
packages/fineui/src/core/wrapper/layout/layout.table.js

@ -59,7 +59,7 @@ export class TableLayout extends Layout {
return { return {
type: "bi.default", type: "bi.default",
ref(_ref) { ref: (_ref) => {
this.layout = _ref; this.layout = _ref;
}, },
items: this._formatItems(items), items: this._formatItems(items),

2
packages/fineui/src/fix/fix.js

@ -1386,7 +1386,7 @@ class Model {
this.$$computed = null; this.$$computed = null;
this.$$state = null; this.$$state = null;
this.$$context = null; this.$$context = null;
this.model = null; this.model = {}; // 一些异步请求里访问model里的属性,这里先变成空对象,保证部分场景下不报错,其他报错会try catch
this._destroyHandler && this._destroyHandler(); this._destroyHandler && this._destroyHandler();
} }
} }

Loading…
Cancel
Save