Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
2a9be9dd
D
Docs
项目概览
OpenHarmony
/
Docs
12 个月 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2a9be9dd
编写于
8月 26, 2022
作者:
Z
zhaolinglan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify example code
Signed-off-by:
N
zhaolinglan
<
zhaolinglan@huawei.com
>
上级
01dfdb2d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
16 deletion
+16
-16
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
+16
-16
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
浏览文件 @
2a9be9dd
...
...
@@ -94,16 +94,12 @@ switchInputMethod(target: InputMethodProperty, callback: AsyncCallback<boolea
**示例:**
```
js
inputMethod
.
switchInputMethod
({
packageName
:
"
com.example.kikakeyboard
"
,
methodId
:
"
com.example.kikakeyboard
"
}
,(
err
,
result
)
=>
{
if
(
err
==
undefined
)
{
console
.
info
(
"
switchInputMethod callback result---err:
"
+
err
.
msg
);
inputMethod
.
switchInputMethod
({
packageName
:
"
com.example.kikakeyboard
"
,
methodId
:
"
com.example.kikakeyboard
"
}
,(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
"
switchInputMethod err:
"
+
JSON
.
stringify
(
err
)
);
return
;
}
if
(
result
)
{
console
.
info
(
"
Success to switchInputMethod.(callback)
"
);
}
else
{
console
.
info
(
"
Failed to switchInputMethod.(callback)
"
);
}
console
.
log
(
"
switchInputMethod success result:
"
+
data
);
});
```
## inputMethod.switchInputMethod<sup>9+</sup>
...
...
@@ -137,7 +133,7 @@ async function InputMethod() {
console
.
info
(
"
Failed to switchInputMethod.(promise)
"
);
}
}).
catch
((
err
)
=>
{
console
.
info
(
"
switchInputMethod promise err:
"
+
err
.
msg
);
console
.
info
(
"
switchInputMethod promise err:
"
+
err
);
});
}
```
...
...
@@ -164,10 +160,10 @@ stopInput(callback: AsyncCallback<boolean>): void
```
js
InputMethodController
.
stopInput
((
error
,
data
)
=>
{
if
(
error
)
{
console
.
error
(
`failed to stopInput because: `
+
JSON
.
stringify
(
error
));
console
.
error
(
"
failed to stopInput because:
"
+
JSON
.
stringify
(
error
));
return
;
}
console
.
info
(
`success stopInput: `
+
JSON
.
stringify
(
data
));
console
.
info
(
"
success stopInput:
"
+
JSON
.
stringify
(
data
));
});
```
...
...
@@ -197,7 +193,7 @@ async function InputMethod() {
console
.
info
(
"
Failed to stopInput.(promise)
"
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
stopInput promise err:
"
+
err
.
msg
);
console
.
error
(
"
stopInput promise err:
"
+
err
);
});
}
```
...
...
@@ -324,12 +320,14 @@ listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>)
**示例:**
```
js
imeList
:
Array
<
inputMethod
.
InputMethodProperty
>
=
null
InputMethodSetting
.
listInputMethod
((
err
,
data
)
=>
{
if
(
err
==
undefined
)
{
console
.
error
(
"
fail to listInputMethod because:
"
+
JSON
.
stringify
(
err
));
return
;
}
Array
<
InputMethodProperty
>
imeListStr
=
JSON
.
stringify
(
data
);
console
.
log
(
"
success listInputMethod
"
);
this
.
imeList
=
data
;
});
```
...
...
@@ -349,11 +347,13 @@ listInputMethod(): Promise<Array<InputMethodProperty>>
**示例:**
```
js
imeList
:
Array
<
inputMethod
.
InputMethodProperty
>
=
null
async
function
InputMethod
()
{
await
InputMethodSetting
.
listInputMethod
().
then
((
data
)
=>
{
console
.
info
(
"
listInputMethod promise result---data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
listInputMethod success
"
);
this
.
imeList
=
data
;
}).
catch
((
err
)
=>
{
console
.
info
(
"
listInputMethod promise err:
"
+
err
.
msg
);
console
.
info
(
"
listInputMethod promise err:
"
+
err
);
});
}
```
...
...
@@ -405,7 +405,7 @@ async function InputMethod() {
await
InputMethodSetting
.
displayOptionalInputMethod
().
then
(()
=>
{
console
.
info
(
"
displayOptionalInputMethod promise
"
);
}).
catch
((
err
)
=>
{
console
.
info
(
"
displayOptionalInputMethod promise err:
"
+
err
.
msg
);
console
.
info
(
"
displayOptionalInputMethod promise err:
"
+
err
);
});
}
```
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录