Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Coping0606
Docs
提交
3d6997ba
D
Docs
项目概览
Coping0606
/
Docs
与 Fork 源项目一致
Fork自
OpenHarmony / Docs
通知
1
Star
1
Fork
0
代码
文件
提交
分支
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,发现更多精彩内容 >>
未验证
提交
3d6997ba
编写于
8月 18, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 18, 2022
浏览文件
操作
浏览文件
下载
差异文件
!8256 修改输入法框架
Merge pull request !8256 from mashaoyin/master
上级
dec56aef
b726761d
变更
2
展开全部
显示空白变更内容
内联
并排
Showing
2 changed file
with
295 addition
and
130 deletion
+295
-130
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
+66
-36
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
...plication-dev/reference/apis/js-apis-inputmethodengine.md
+229
-94
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
浏览文件 @
3d6997ba
...
...
@@ -45,9 +45,9 @@ getInputMethodController(): InputMethodController
**返回值:**
| 类型 | 说明
|
| -------- |
-------- |
| [InputMethodController](#inputmethodcontroller) | 回调返回当前客户端实例。 |
| 类型 | 说明
|
| ----------------------------------------------- | ----------------
-------- |
|
[
InputMethodController
](
#inputmethodcontroller
)
| 回调返回当前客户端实例。 |
**示例:**
...
...
@@ -79,7 +79,7 @@ getInputMethodSetting(): InputMethodSetting
switchInputMethod(target: InputmethodProperty, callback: AsyncCallback
<
boolean
>
): void;
切换输入法。此接口仅可在Stage模型下使用。
切换输入法。此接口仅可在Stage模型下使用。
使用callback形式返回结果。参数个数为2,否则抛出异常。
**系统能力**
:SystemCapability.Miscservices.InputMethodFramework
...
...
@@ -102,7 +102,7 @@ switchInputMethod(target: InputmethodProperty, callback: AsyncCallback<boolea
## inputMethod.switchInputMethod<sup>9+</sup>
switchInputMethod(target: InputmethodProperty): Promise
<
boolean
>
切换输入法。此接口仅可在Stage模型下使用。
切换输入法。此接口仅可在Stage模型下使用。
使用promise形式返回结果。参数个数为1,否则抛出异常。
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
...
...
@@ -133,7 +133,7 @@ switchInputMethod(target: InputmethodProperty): Promise<boolean>
stopInput(callback: AsyncCallback
<
boolean
>
): void
隐藏输入法。
隐藏输入法。
使用callback形式返回结果。参数个数为1,否则抛出异常。
**系统能力**
:SystemCapability.MiscServices.InputMethodFramework
...
...
@@ -146,16 +146,24 @@ stopInput(callback: AsyncCallback<boolean>): void
**示例:**
```
js
InputMethodController
.
stopInput
((
error
)
=>
{
console
.
info
(
'
stopInput
'
);
});
InputMethodController
.
stopInput
((
err
,
result
)
=>
{
if
(
err
==
undefined
)
{
console
.
error
(
"
stopInput callback result---err:
"
+
err
.
msg
);
return
;
}
if
(
result
)
{
console
.
info
(
"
Success to stopInput.(callback)
"
);
}
else
{
console
.
info
(
"
Failed to stopInput.(callback)
"
);
}
});
```
### stopInput
stopInput(): Promise
<
boolean
>
隐藏输入法。
隐藏输入法。
使用promise形式返回结果。参数个数为0,否则抛出异常。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
...
@@ -169,15 +177,24 @@ stopInput(): Promise<boolean>
```
js
var
isSuccess
=
InputMethodController
.
stopInput
();
console
.
info
(
'
stopInput isSuccess =
'
+
isSuccess
);
async
function
InputMethod
()
{
await
InputMethodController
.
stopInput
().
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
"
Success to stopInput.(promise)
"
);
}
else
{
console
.
info
(
"
Failed to stopInput.(promise)
"
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
stopInput promise err:
"
+
err
.
msg
);
});
}
```
### showSoftKeyboard<sup>9+</sup> ###
showSoftKeyboard(callback: AsyncCallback
<
void
>
): void
显示软键盘,使用callback异步回调。
显示软键盘,使用callback异步回调。
参数个数为1,否则抛出异常。
**系统能力:**
SystemCapability.MiscServices.InputMethodFramework
...
...
@@ -204,7 +221,7 @@ InputMethodController.showSoftKeyboard((err) => {
showSoftKeyboard(): Promise
<
void
>
显示软键盘,使用Promise异步回调。
显示软键盘,使用Promise异步回调。
参数个数为0,否则抛出异常。
**系统能力:**
SystemCapability.MiscServices.InputMethodFramework
...
...
@@ -228,7 +245,7 @@ InputMethodController.showSoftKeyboard().then(async (err) => {
hideSoftKeyboard(callback: AsyncCallback
<
void
>
): void
隐藏软键盘,使用callback异步回调。
隐藏软键盘,使用callback异步回调。
参数个数为1,否则抛出异常。
**系统能力:**
SystemCapability.MiscServices.InputMethodFramework
...
...
@@ -255,7 +272,7 @@ InputMethodController.hideSoftKeyboard((err) => {
hideSoftKeyboard(): Promise
<
void
>
隐藏软键盘,使用Promise异步回调。
隐藏软键盘,使用Promise异步回调。
参数个数为0,否则抛出异常。
**系统能力:**
SystemCapability.MiscServices.InputMethodFramework
...
...
@@ -283,7 +300,7 @@ InputMethodController.hideSoftKeyboard().then(async (err) => {
listInputMethod(callback: AsyncCallback
<
Array
<
InputMethodProperty
>>
): void
查询已安装的输入法列表。
查询已安装的输入法列表。
使用callback形式返回结果。参数个数为1,否则抛出异常。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
...
@@ -295,19 +312,20 @@ listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>)
**示例:**
```
js
InputMethodSetting
.
listInputMethod
((
properties
)
=>
{
for
(
var
i
=
0
;
i
<
properties
.
length
;
i
++
)
{
var
property
=
properties
[
i
]
;
console
.
info
(
property
.
packageName
+
"
/
"
+
property
.
methodId
)
;
InputMethodSetting
.
listInputMethod
((
err
,
data
)
=>
{
if
(
err
==
undefined
)
{
console
.
error
(
"
listInputMethod callback result---err:
"
+
err
.
msg
)
;
return
;
}
console
.
info
(
"
listInputMethod callback result---data:
"
+
JSON
.
stringify
(
data
));
});
```
### listInputMethod
listInputMethod():
Array
<
InputMethodProperty
>
;
listInputMethod():
Promise
<Array
<
InputMethodProperty
>
>
;
查询已安装的输入法列表。
查询已安装的输入法列表。
使用promise形式返回结果。参数个数为0,否则抛出异常。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
...
@@ -319,18 +337,20 @@ listInputMethod(): Array<InputMethodProperty>
**示例:**
```
js
var
properties
=
InputMethodSetting
.
listInputMethod
();
for
(
var
i
=
0
;
i
<
properties
.
length
;
i
++
)
{
var
property
=
properties
[
i
];
console
.
info
(
property
.
packageName
+
"
/
"
+
property
.
methodId
);
}
async
function
InputMethod
()
{
await
InputMethodSetting
.
listInputMethod
().
then
((
data
)
=>
{
console
.
info
(
"
listInputMethod promise result---data:
"
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
"
listInputMethod promise err:
"
+
err
.
msg
);
});
}
```
### displayOptionalInputMethod
displayOptionalInputMethod(callback: AsyncCallback
<
void
>
): void
显示输入法选择对话框。
显示输入法选择对话框。
使用callback形式返回结果。参数个数为1,否则抛出异常。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
...
@@ -343,16 +363,20 @@ displayOptionalInputMethod(callback: AsyncCallback<void>): void
**示例:**
```
js
InputMethodSetting
.
displayOptionalInputMethod
(()
=>
{
console
.
info
(
'
displayOptionalInputMethod is called
'
);
});
InputMethodSetting
.
displayOptionalInputMethod
((
err
)
=>
{
if
(
err
==
undefined
)
{
console
.
error
(
"
displayOptionalInputMethod callback---err:
"
+
err
.
msg
);
return
;
}
console
.
info
(
"
displayOptionalInputMethod callback
"
);
});
```
### displayOptionalInputMethod
displayOptionalInputMethod(): Promise
<
void
>
显示输入法选择对话框。
显示输入法选择对话框。
使用promise形式返回结果。参数个数为0,否则抛出异常。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
...
@@ -360,10 +384,16 @@ displayOptionalInputMethod(callback: AsyncCallback<void>): void
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
|
回调函数
。 |
| Promise
<
void
>
|
无返回结果的Promise对象
。 |
**示例:**
```
js
InputMethodSetting
.
displayOptionalInputMethod
();
async
function
InputMethod
()
{
await
InputMethodSetting
.
displayOptionalInputMethod
().
then
(()
=>
{
console
.
info
(
"
displayOptionalInputMethod promise
"
);
}).
catch
((
err
)
=>
{
console
.
info
(
"
listInputMethod promise err:
"
+
err
.
msg
);
});
}
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
浏览文件 @
3d6997ba
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录