From dfdb3c2fa3c01d7136e2ef1d3838ad9d883ef7e2 Mon Sep 17 00:00:00 2001 From: liujiahui Date: Tue, 13 May 2025 16:32:16 +0800 Subject: [PATCH] =?UTF-8?q?=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 --- entry/src/main/ets/pages/Index.ets | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 28412bb..48384ef 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -36,7 +36,7 @@ struct Index { .fontSize(16) .width('100%') .onClick(() => { - promptAction.showToast({ message: 'Native method call succeed, result is ' + napi.add(2, 3).toString() }); + this.getUIContext().getPromptAction().showToast({ message: 'Native method call succeed, result is ' + napi.add(2, 3).toString() }); }) Button($r('app.string.call_har_native_method')) @@ -44,7 +44,7 @@ struct Index { .width('100%') .margin({ top: 12 }) .onClick(() => { - promptAction.showToast({ + this.getUIContext().getPromptAction().showToast({ message: 'HarNative method call succeed, result is ' + napi.invokeHarNative(2, 3).toString() }); }) @@ -54,7 +54,7 @@ struct Index { .width('100%') .margin({ top: 12 }) .onClick(() => { - promptAction.showToast({ message: 'HarArkTS method call succeed, result is ' + this.getUIContext().getPromptAction().showToast({ message: 'HarArkTS method call succeed, result is ' + napi.invokeHarArkTS(2, 3).toString() }); }) @@ -63,7 +63,7 @@ struct Index { .width('100%') .margin({ top: 12 }) .onClick(() => { - promptAction.showToast({ + this.getUIContext().getPromptAction().showToast({ message: 'HspNative method call succeed, result is ' + napi.invokeHspNative(2, 3).toString() }); }) @@ -73,7 +73,7 @@ struct Index { .width('100%') .margin({ top: 12 }) .onClick(() => { - promptAction.showToast({ message: 'HspArkTS method call succeed, result is ' + this.getUIContext().getPromptAction().showToast({ message: 'HspArkTS method call succeed, result is ' + napi.invokeHspArkTS(2, 3).toString() }); }) } -- Gitee