From 01dfdb2d7e5e5523bc84fc4048d85914e7406ee1 Mon Sep 17 00:00:00 2001 From: zhaolinglan Date: Fri, 26 Aug 2022 16:37:37 +0800 Subject: [PATCH] fix compile err Signed-off-by: zhaolinglan --- .../js-apis-inputmethod-extension-ability.md | 2 +- .../reference/apis/js-apis-inputmethod.md | 24 ++++++++----------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md index 99e8bf16a6..32b5e53b41 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md @@ -10,7 +10,7 @@ InputMethodExtensionAbility模块,提供生态输入法应用开发者通过In ## 导入模块 ``` -import InputMethodExtension from '@ohos.inputmethodextensionability'; +import InputMethodExtensionAbility from '@ohos.inputmethodextensionability'; ``` ## 属性 diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md index fd21f25719..b8a89a48da 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md @@ -94,7 +94,7 @@ switchInputMethod(target: InputMethodProperty, callback: AsyncCallback<boolea **示例:** ```js -inputmethod.switchInputMethod({packageName:"com.example.kikakeyboard", methodId:"com.example.kikakeyboard"} ,(err,result) => { +inputMethod.switchInputMethod({packageName:"com.example.kikakeyboard", methodId:"com.example.kikakeyboard"} ,(err,result) => { if (err == undefined) { console.info("switchInputMethod callback result---err: " + err.msg); return; @@ -162,16 +162,12 @@ stopInput(callback: AsyncCallback<boolean>): void **示例:** ```js -InputMethodController.stopInput((err, result) => { - if (err == undefined) { - console.error("stopInput callback result---err: " + err.msg); +InputMethodController.stopInput((error, data) => { + if (error) { + console.error(`failed to stopInput because: ` + JSON.stringify(error)); return; } - if (result) { - console.info("Success to stopInput.(callback)"); - } else { - console.info("Failed to stopInput.(callback)"); - } + console.info(`success stopInput: ` + JSON.stringify(data)); }); ``` @@ -330,10 +326,10 @@ listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>) ```js InputMethodSetting.listInputMethod((err,data) => { if (err == undefined) { - console.error("listInputMethod callback result---err: " + err.msg); + console.error("fail to listInputMethod because: " + JSON.stringify(err)); return; } - console.info("listInputMethod callback result---data: " + JSON.stringify(data)); + Array imeListStr = JSON.stringify(data); }); ``` @@ -381,10 +377,10 @@ displayOptionalInputMethod(callback: AsyncCallback<void>): void ```js InputMethodSetting.displayOptionalInputMethod((err) => { if (err == undefined) { - console.error("displayOptionalInputMethod callback---err: " + err.msg); + console.error("failed to displayOptionalInputMethod because: " + JSON.stringify(err)); return; } - console.info("displayOptionalInputMethod callback"); + console.info("success displayOptionalInputMethod"); }); ``` @@ -409,7 +405,7 @@ async function InputMethod() { await InputMethodSetting.displayOptionalInputMethod().then(()=>{ console.info("displayOptionalInputMethod promise"); }).catch((err) => { - console.info("listInputMethod promise err: " + err.msg); + console.info("displayOptionalInputMethod promise err: " + err.msg); }); } ``` \ No newline at end of file -- GitLab