Update yx-collection-view.ts

修复set content方法中super在构建后被编译器优化指向成this导致死循环的bug
This commit is contained in:
Yida.Xu 2025-05-12 10:31:27 +08:00 committed by GitHub
parent e3cb12d571
commit cdefb153bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -296,14 +296,14 @@ class _scroll_view extends ScrollView {
} }
set content(value) { set content(value) {
super.content = value; Reflect.set(ScrollView.prototype, 'content', value, this);
if (value) { if (value) {
value.on(NodeEventType.SIZE_CHANGED, this._calculateBoundary, this); value.on(NodeEventType.SIZE_CHANGED, this._calculateBoundary, this);
value.on(NodeEventType.TRANSFORM_CHANGED, this._scaleChanged, this); value.on(NodeEventType.TRANSFORM_CHANGED, this._scaleChanged, this);
} }
} }
get content() { get content() {
return super.content; return Reflect.get(ScrollView.prototype, 'content', this);
} }
} }
@ -930,7 +930,6 @@ export class YXCollectionView extends Component {
*/ */
reloadData() { reloadData() {
if (this.node.activeInHierarchy && this.node.parent) { if (this.node.activeInHierarchy && this.node.parent) {
// this.getComponent(Widget).updateAlignment?.();
this._reloadData() this._reloadData()
return return
} }
@ -1529,4 +1528,4 @@ export abstract class YXBinaryLayout extends YXLayout {
return result return result
} }
} }