From b7fdcf2f96e221d880c5ab7c66c8d6a0bc0028ce Mon Sep 17 00:00:00 2001 From: Haoming Luo Date: Thu, 27 Jul 2023 17:42:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0'=E4=BD=BF=E7=94=A8=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E4=B8=ADHSP'=E9=83=A8=E5=88=86=E4=B8=AD=E4=B8=8E'?= =?UTF-8?q?=E5=AF=BC=E5=87=BAHSP=E4=B8=AD=E8=B5=84=E6=BA=90'=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=9A=84=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haoming Luo --- zh-cn/application-dev/quick-start/in-app-hsp.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/zh-cn/application-dev/quick-start/in-app-hsp.md b/zh-cn/application-dev/quick-start/in-app-hsp.md index ca027cc1af..7abaf5d113 100644 --- a/zh-cn/application-dev/quick-start/in-app-hsp.md +++ b/zh-cn/application-dev/quick-start/in-app-hsp.md @@ -137,7 +137,7 @@ export { nativeMulti } from './utils/nativeTest' 在使用方的代码中,可以这样使用: ```ts // entry/src/main/ets/pages/index.ets -import { Log, add, MyTitleBar, nativeMulti, ResManager } from "library" +import { Log, add, MyTitleBar, ResManager, nativeMulti } from "library" @Entry @Component @@ -157,6 +157,18 @@ struct Index { }) Image(ResManager.getPic()) .width("100%") + Button('getStringValue') + .onClick(()=> { + // 先通过当前上下文获取hsp模块的上下文,再获取hsp模块的resourceManager,然后再调用resourceManager的接口获取资源 + getContext().createModuleContext('library').resourceManager.getStringValue(ResManager.getDesc()) + .then(value => { + console.log("getStringByName value is " + value); + }) + .catch(error => { + console.log("getStringByName promise error is " + error); + }); + }) + .width("50%") Button('nativeMulti(3, 4)') .onClick(()=>{ Log.info("nativeMulti button click!"); -- GitLab