diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index b2e99b706f35ee31a4c526878fdf6af9153a2734..11c37c8a6c80560d93d82e833b41ab1cf338e269 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -34,11 +34,11 @@ struct Index { aboutToAppear(): void { this.classifyList = new ClassifyViewModel().getClassifyModelList(); - window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + window.getLastWindow(this.getUIContext().getHostContext()).then((windowStage: window.Window) => { let area = windowStage.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); - this.topArea = px2vp(area.topRect.height); + this.topArea = this.getUIContext().px2vp(area.topRect.height); let bottom = windowStage.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR); - this.bottomArea = px2vp(bottom.bottomRect.height); + this.bottomArea = this.getUIContext().px2vp(bottom.bottomRect.height); if (this.topArea > 0) { windowStage.setWindowLayoutFullScreen(true); } @@ -69,7 +69,7 @@ struct Index { right: $r('app.float.image_margin_right') }) .onClick(() => { - router.back(); + this.getUIContext().getRouter().back(); }) Text($r('app.string.title')) @@ -132,7 +132,7 @@ struct Index { Text(item.classifyName) .fontSize($r('app.float.common_font_size')) .fontColor(index === this.currentClassify ? - $r('app.color.select_title_color') : $r('app.color.title_color')) + $r('app.color.select_title_color') : $r('app.color.title_color')) .fontWeight(index === this.currentClassify ? CommonConstants.FONT_WEIGHT_500 : FontWeight.Normal) .fontFamily($r('app.string.common_font_family')) .width($r('app.float.item_width'))