Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
e5519ec0
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
未验证
提交
e5519ec0
编写于
11月 21, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 21, 2022
浏览文件
操作
浏览文件
下载
差异文件
!11616 【输入法框架】示例代码问题排查修改
Merge pull request !11616 from Hollokin/master
上级
e690296e
df7c3b74
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
30 deletion
+31
-30
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
+31
-30
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
浏览文件 @
e5519ec0
...
...
@@ -93,7 +93,7 @@ getSetting(): InputMethodSetting
**示例:**
```
js
let
I
nputMethodSetting
=
inputMethod
.
getSetting
();
let
i
nputMethodSetting
=
inputMethod
.
getSetting
();
```
## inputMethod.switchInputMethod<sup>9+</sup>
...
...
@@ -239,7 +239,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallb
```
js
let
inputMethodSubtype
=
{
id
:
"
com.example.kika
input
"
,
id
:
"
com.example.kika
keyboard
"
,
label
:
"
ServiceExtAbility
"
,
name
:
""
,
mode
:
"
upper
"
,
...
...
@@ -301,7 +301,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise<boolean&
```
js
let
inputMethodSubtype
=
{
id
:
"
com.example.kika
input
"
,
id
:
"
com.example.kika
keyboard
"
,
label
:
"
ServiceExtAbility
"
,
name
:
""
,
mode
:
"
upper
"
,
...
...
@@ -382,7 +382,7 @@ let inputMethodProperty = {
extra
:
{}
}
let
inputMethodSubProperty
=
{
id
:
"
com.example.kika
input
"
,
id
:
"
com.example.kika
keyboard
"
,
label
:
"
ServiceExtAbility
"
,
name
:
""
,
mode
:
"
upper
"
,
...
...
@@ -445,19 +445,23 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp
```
js
let
inputMethodProperty
=
{
name
:
"
com.example.kikakeyboard
"
,
id
:
"
ServiceExtAbility
"
packageName
:
"
com.example.kikakeyboard
"
,
methodId
:
"
ServiceExtAbility
"
,
extra
:
{}
}
let
inputMethodSubProperty
=
{
id
:
"
com.example.kikakeyboard
"
,
name
:
""
,
locale
:
""
,
label
:
"
ServiceExtAbility
"
,
language
:
""
,
extra
:
{}
name
:
""
,
mode
:
"
upper
"
,
locale
:
""
,
language
:
""
,
icon
:
""
,
iconId
:
0
,
extra
:
{}
}
try
{
inputMethod
.
switchCurrentInputMethodAndSubtype
(
property
,
subType
).
then
((
result
)
=>
{
inputMethod
.
switchCurrentInputMethodAndSubtype
(
inputMethodProperty
,
inputMethodSubProperty
).
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
'
Success to switchCurrentInputMethodAndSubtype.
'
);
}
else
{
...
...
@@ -514,7 +518,7 @@ getInputMethodSetting(): InputMethodSetting
**示例:**
```
js
let
I
nputMethodSetting
=
inputMethod
.
getInputMethodSetting
();
let
i
nputMethodSetting
=
inputMethod
.
getInputMethodSetting
();
```
## InputMethodController
...
...
@@ -837,10 +841,8 @@ on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, input
**示例:**
```
js
let
InputMethodSetting
=
inputMethod
.
getSetting
();
InputMethodSetting
.
on
(
'
imeChange
'
,
(
inputMethodProperty
,
inputMethodSubtype
)
=>
{
InputMethodProperty
=
inputMethodProperty
;
InputMethodSubtype
=
inputMethodSubtype
;
inputMethodSetting
.
on
(
'
imeChange
'
,
(
inputMethodProperty
,
inputMethodSubtype
)
=>
{
console
.
info
(
'
Succeeded in subscribing imeChange: inputMethodProperty:
'
+
JSON
.
stringify
(
inputMethodProperty
)
+
"
, inputMethodSubtype:
"
+
JSON
.
stringify
(
inputMethodSubtype
));
});
```
...
...
@@ -862,8 +864,7 @@ off(type: 'imeChange', callback?: (inputMethodProperty: InputMethodProperty, inp
**示例:**
```
js
let
InputMethodSetting
=
inputMethod
.
getSetting
();
InputMethodSetting
.
off
(
'
imeChange
'
);
inputMethodSetting
.
off
(
'
imeChange
'
);
```
### listInputMethodSubtype<sup>9+</sup>
...
...
@@ -899,7 +900,7 @@ let inputMethodProperty = {
extra
:{}
}
try
{
I
nputMethodSetting
.
listInputMethodSubtype
(
inputMethodProperty
,
(
err
,
data
)
=>
{
i
nputMethodSetting
.
listInputMethodSubtype
(
inputMethodProperty
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
listInputMethodSubtype failed:
'
+
JSON
.
stringify
(
err
));
return
;
...
...
@@ -949,7 +950,7 @@ let inputMethodProperty = {
extra
:{}
}
try
{
I
nputMethodSetting
.
listInputMethodSubtype
(
inputMethodProperty
).
then
((
data
)
=>
{
i
nputMethodSetting
.
listInputMethodSubtype
(
inputMethodProperty
).
then
((
data
)
=>
{
console
.
info
(
'
listInputMethodSubtype success
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
listInputMethodSubtype err:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -986,7 +987,7 @@ listCurrentInputMethodSubtype(callback: AsyncCallback<Array<InputMethodSub
```
js
try
{
I
nputMethodSetting
.
listCurrentInputMethodSubtype
((
err
,
data
)
=>
{
i
nputMethodSetting
.
listCurrentInputMethodSubtype
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
listCurrentInputMethodSubtype failed:
'
+
JSON
.
stringify
(
err
));
return
;
...
...
@@ -1025,7 +1026,7 @@ listCurrentInputMethodSubtype(): Promise<Array<InputMethodSubtype>>
```
js
try
{
I
nputMethodSetting
.
listCurrentInputMethodSubtype
().
then
((
data
)
=>
{
i
nputMethodSetting
.
listCurrentInputMethodSubtype
().
then
((
data
)
=>
{
console
.
info
(
'
listCurrentInputMethodSubtype success
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
listCurrentInputMethodSubtype err:
'
+
err
);
...
...
@@ -1063,7 +1064,7 @@ getInputMethods(enable: boolean, callback: AsyncCallback<Array<InputMethod
```
js
try
{
I
nputMethodSetting
.
getInputMethods
(
true
,
(
err
,
data
)
=>
{
i
nputMethodSetting
.
getInputMethods
(
true
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
getInputMethods failed:
'
+
JSON
.
stringify
(
err
));
return
;
...
...
@@ -1108,7 +1109,7 @@ getInputMethods(enable: boolean): Promise<Array<InputMethodProperty>>
```
js
try
{
I
nputMethodSetting
.
getInputMethods
(
true
).
then
((
data
)
=>
{
i
nputMethodSetting
.
getInputMethods
(
true
).
then
((
data
)
=>
{
console
.
info
(
'
getInputMethods success
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
getInputMethods err:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -1146,7 +1147,7 @@ showOptionalInputMethods(callback: AsyncCallback<boolean>): void
```
js
try
{
I
nputMethodSetting
.
showOptionalInputMethods
((
err
,
data
)
=>
{
i
nputMethodSetting
.
showOptionalInputMethods
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
showOptionalInputMethods failed:
'
+
JSON
.
stringify
(
err
));
return
;
...
...
@@ -1185,7 +1186,7 @@ showOptionalInputMethods(): Promise<boolean>
**示例:**
```
js
I
nputMethodSetting
.
showOptionalInputMethods
().
then
((
data
)
=>
{
i
nputMethodSetting
.
showOptionalInputMethods
().
then
((
data
)
=>
{
console
.
info
(
'
displayOptionalInputMethod success.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
displayOptionalInputMethod err:
'
+
err
);
...
...
@@ -1213,7 +1214,7 @@ listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>)
**示例:**
```
js
I
nputMethodSetting
.
listInputMethod
((
err
,
data
)
=>
{
i
nputMethodSetting
.
listInputMethod
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
listInputMethod failed because:
'
+
JSON
.
stringify
(
err
));
return
;
...
...
@@ -1243,7 +1244,7 @@ listInputMethod(): Promise<Array<InputMethodProperty>>
**示例:**
```
js
I
nputMethodSetting
.
listInputMethod
().
then
((
data
)
=>
{
i
nputMethodSetting
.
listInputMethod
().
then
((
data
)
=>
{
console
.
info
(
'
listInputMethod success
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
listInputMethod err:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -1271,7 +1272,7 @@ displayOptionalInputMethod(callback: AsyncCallback<void>): void
**示例:**
```
js
I
nputMethodSetting
.
displayOptionalInputMethod
((
err
)
=>
{
i
nputMethodSetting
.
displayOptionalInputMethod
((
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
displayOptionalInputMethod failed because:
'
+
JSON
.
stringify
(
err
));
return
;
...
...
@@ -1301,7 +1302,7 @@ displayOptionalInputMethod(): Promise<void>
**示例:**
```
js
I
nputMethodSetting
.
displayOptionalInputMethod
().
then
(()
=>
{
i
nputMethodSetting
.
displayOptionalInputMethod
().
then
(()
=>
{
console
.
info
(
'
displayOptionalInputMethod success
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
displayOptionalInputMethod err:
'
+
err
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录