From de5c3a98b597c25870bfe3261621d2bd104e7f1d Mon Sep 17 00:00:00 2001 From: kuangning <2540487435@qq.com> Date: Thu, 8 May 2025 10:11:04 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9Aapi=E5=8D=87=E7=BA=A7=E8=87=B316?= =?UTF-8?q?=EF=BC=8C=E5=BA=9F=E5=BC=83api=20=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-profile.json5 | 2 +- entry/src/main/ets/pages/Index.ets | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build-profile.json5 b/build-profile.json5 index c033ce4..e8de1a3 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -5,7 +5,7 @@ { "name": "default", "signingConfig": "default", - "compatibleSdkVersion": "5.0.0(12)", + "compatibleSdkVersion": "5.0.4(16)", "runtimeOS": "HarmonyOS", } ], diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index ab29fb4..5a4572e 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -34,7 +34,7 @@ struct Index { Column({ space: 12 }) { ForEach(this.dataArr, (item: CardListItemData, index: number) => { DataItemView({ itemData: item }) - .margin({ bottom: index === this.dataArr.length - 1 ? px2vp(this.bottomHeight) : 0 }) + .margin({ bottom: index === this.dataArr.length - 1 ? this.getUIContext().px2vp(this.bottomHeight) : 0 }) }, (item: CardListItemData, index: number) => index + JSON.stringify(item)) } } @@ -51,7 +51,7 @@ struct Index { .width('100%') .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) .backgroundColor('#F1F3F5') - .padding({ top: px2vp(this.topHeight) }) + .padding({ top: this.getUIContext().px2vp(this.topHeight) }) } } @@ -101,7 +101,7 @@ struct DataItemView { } .onClick(() => { let util = PreferencesUtil.getInstance(); - let preferences = util.getPreferences(getContext(this)); + let preferences = util.getPreferences(this.getUIContext().getHostContext()!); this.statusArr[this.itemData.id] = !this.statusArr[this.itemData.id]; this.itemData.favour = this.statusArr[this.itemData.id!]; util.preferencesPut(preferences, 'statusArr', this.statusArr); -- Gitee