未验证 提交 a3888b56 编写于 作者: O openharmony_ci 提交者: Gitee

!8339 修改inputmethod

Merge pull request !8339 from mashaoyin/master
......@@ -95,9 +95,17 @@ switchInputMethod(target: InputmethodProperty, callback: AsyncCallback<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.
先完成此消息的编辑!
想要评论请 注册