提交 c9531b29 编写于 作者: M ma-shaoyin

Signed-off-by: ma-shaoyin <mashaoyin1@huawei.com>

 Changes to be committed:
上级 b726761d
......@@ -95,9 +95,17 @@ switchInputMethod(target: InputmethodProperty, callback: AsyncCallback&lt;boolea
**示例:**
```js
inputMethod.switchInputMethod({packageName:"com.ohos.inputApp", methodId:"InputDemoService"}).then(res => {
prompt.showToast({message:"切换输入法成功" + this.imeList[this.flag].packageName, duration: 200});
});
inputmethod.switchInputMethod({packageName:"com.example.kikakeyboard", methodId:"com.example.kikakeyboard"} ,(err,result) => {
if (err == undefined) {
console.info("switchInputMethod callback result---err: " + err.msg);
return;
}
if (result) {
console.info("Success to switchInputMethod.(callback)");
} else {
console.info("Failed to switchInputMethod.(callback)");
}
});
```
## inputMethod.switchInputMethod<sup>9+</sup>
switchInputMethod(target: InputmethodProperty): Promise&lt;boolean&gt;
......@@ -121,9 +129,18 @@ switchInputMethod(target: InputmethodProperty): Promise&lt;boolean&gt;
```js
inputMethod.switchInputMethod({packageName:"com.ohos.inputApp", methodId:"InputDemoService"}).then(res => {
prompt.showToast({message:"切换输入法成功" + this.imeList[this.flag].packageName, duration: 200});
});
async function InputMethod() {
await inputMethod.switchInputMethod({packageName:"com.example.kikakeyboard",
methodId:"com.example.kikakeyboard"}).then((result) => {
if (result) {
console.info("Success to switchInputMethod.(promise)");
} else {
console.info("Failed to switchInputMethod.(promise)");
}
}).catch((err) => {
console.info("switchInputMethod promise err: " + err.msg);
});
}
```
## InputMethodController
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册