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 99e8bf16a6845f4485c32b76454e2a54fd79ba34..32b5e53b412e1a4c071ce7cfbcabf36c62ad0b82 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 fd21f25719ccc7509842bed7b6da19fee55c76c2..b8a89a48dafcd41f40326efeadb0dc2f4281a4f1 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