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. 6
      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) {
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 {

4
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);
},
};

6
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);
})), []);
}

2
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();
}
}

Loading…
Cancel
Save