Skip to content

Commit 60cbcb9

Browse files
fix: 修复方法调用问题
1 parent 4eb9946 commit 60cbcb9

File tree

1 file changed

+4
-3
lines changed
  • packages/core/src/models

1 file changed

+4
-3
lines changed

packages/core/src/models/app.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ export class LowCodeRoot extends Subscribe {
108108
// 根据屏幕大小计算出跟节点的font-size,用于rem样式的适配
109109
if (this.isH5()) {
110110
this.calcFontsize()
111-
globalThis.removeEventListener('resize', this.calcFontsize);
112-
globalThis.addEventListener('resize', this.calcFontsize);
111+
globalThis.removeEventListener('resize', this.calcFontsize.bind(this));
112+
globalThis.addEventListener('resize', this.calcFontsize.bind(this));
113113
}
114114
}
115115

@@ -177,6 +177,7 @@ export class LowCodeRoot extends Subscribe {
177177
}
178178

179179
private calcFontsize() {
180+
console.log('resize')
180181
const { width } = document.documentElement.getBoundingClientRect();
181182
const dpr = globalThis?.devicePixelRatio || 1
182183
this.setBodyFontSize(dpr);
@@ -222,7 +223,7 @@ export class LowCodeRoot extends Subscribe {
222223
this.clear()
223224
this.page = undefined;
224225
if (this.isH5()) {
225-
globalThis.removeEventListener('resize', this.calcFontsize);
226+
globalThis.removeEventListener('resize', this.calcFontsize.bind(this));
226227
}
227228
}
228229

0 commit comments

Comments
 (0)