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

!11616 【输入法框架】示例代码问题排查修改

Merge pull request !11616 from Hollokin/master
......@@ -93,7 +93,7 @@ getSetting(): InputMethodSetting
**示例:**
```js
let InputMethodSetting = inputMethod.getSetting();
let inputMethodSetting = inputMethod.getSetting();
```
## inputMethod.switchInputMethod<sup>9+</sup>
......@@ -239,7 +239,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallb
```js
let inputMethodSubtype = {
id: "com.example.kikainput",
id: "com.example.kikakeyboard",
label: "ServiceExtAbility",
name: "",
mode: "upper",
......@@ -301,7 +301,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise&lt;boolean&
```js
let inputMethodSubtype = {
id: "com.example.kikainput",
id: "com.example.kikakeyboard",
label: "ServiceExtAbility",
name: "",
mode: "upper",
......@@ -382,7 +382,7 @@ let inputMethodProperty = {
extra: {}
}
let inputMethodSubProperty = {
id: "com.example.kikainput",
id: "com.example.kikakeyboard",
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 InputMethodSetting = inputMethod.getInputMethodSetting();
let inputMethodSetting = 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 {
InputMethodSetting.listInputMethodSubtype(inputMethodProperty, (err,data) => {
inputMethodSetting.listInputMethodSubtype(inputMethodProperty, (err,data) => {
if (err) {
console.error('listInputMethodSubtype failed: ' + JSON.stringify(err));
return;
......@@ -949,7 +950,7 @@ let inputMethodProperty = {
extra:{}
}
try {
InputMethodSetting.listInputMethodSubtype(inputMethodProperty).then((data) => {
inputMethodSetting.listInputMethodSubtype(inputMethodProperty).then((data) => {
console.info('listInputMethodSubtype success');
}).catch((err) => {
console.error('listInputMethodSubtype err: ' + JSON.stringify(err));
......@@ -986,7 +987,7 @@ listCurrentInputMethodSubtype(callback: AsyncCallback&lt;Array&lt;InputMethodSub
```js
try {
InputMethodSetting.listCurrentInputMethodSubtype((err, data) => {
inputMethodSetting.listCurrentInputMethodSubtype((err, data) => {
if (err) {
console.error('listCurrentInputMethodSubtype failed: ' + JSON.stringify(err));
return;
......@@ -1025,7 +1026,7 @@ listCurrentInputMethodSubtype(): Promise&lt;Array&lt;InputMethodSubtype&gt;&gt;
```js
try {
InputMethodSetting.listCurrentInputMethodSubtype().then((data) => {
inputMethodSetting.listCurrentInputMethodSubtype().then((data) => {
console.info('listCurrentInputMethodSubtype success');
}).catch((err) => {
console.error('listCurrentInputMethodSubtype err: ' + err);
......@@ -1063,7 +1064,7 @@ getInputMethods(enable: boolean, callback: AsyncCallback&lt;Array&lt;InputMethod
```js
try {
InputMethodSetting.getInputMethods(true, (err,data) => {
inputMethodSetting.getInputMethods(true, (err,data) => {
if (err) {
console.error('getInputMethods failed: ' + JSON.stringify(err));
return;
......@@ -1108,7 +1109,7 @@ getInputMethods(enable: boolean): Promise&lt;Array&lt;InputMethodProperty&gt;&gt
```js
try {
InputMethodSetting.getInputMethods(true).then((data) => {
inputMethodSetting.getInputMethods(true).then((data) => {
console.info('getInputMethods success');
}).catch((err) => {
console.error('getInputMethods err: ' + JSON.stringify(err));
......@@ -1146,7 +1147,7 @@ showOptionalInputMethods(callback: AsyncCallback&lt;boolean&gt;): void
```js
try {
InputMethodSetting.showOptionalInputMethods((err, data) => {
inputMethodSetting.showOptionalInputMethods((err, data) => {
if (err) {
console.error('showOptionalInputMethods failed: ' + JSON.stringify(err));
return;
......@@ -1185,7 +1186,7 @@ showOptionalInputMethods(): Promise&lt;boolean&gt;
**示例:**
```js
InputMethodSetting.showOptionalInputMethods().then((data) => {
inputMethodSetting.showOptionalInputMethods().then((data) => {
console.info('displayOptionalInputMethod success.');
}).catch((err) => {
console.error('displayOptionalInputMethod err: ' + err);
......@@ -1213,7 +1214,7 @@ listInputMethod(callback: AsyncCallback&lt;Array&lt;InputMethodProperty&gt;&gt;)
**示例:**
```js
InputMethodSetting.listInputMethod((err,data) => {
inputMethodSetting.listInputMethod((err,data) => {
if (err) {
console.error('listInputMethod failed because: ' + JSON.stringify(err));
return;
......@@ -1243,7 +1244,7 @@ listInputMethod(): Promise&lt;Array&lt;InputMethodProperty&gt;&gt;
**示例:**
```js
InputMethodSetting.listInputMethod().then((data) => {
inputMethodSetting.listInputMethod().then((data) => {
console.info('listInputMethod success');
}).catch((err) => {
console.error('listInputMethod err: ' + JSON.stringify(err));
......@@ -1271,7 +1272,7 @@ displayOptionalInputMethod(callback: AsyncCallback&lt;void&gt;): void
**示例:**
```js
InputMethodSetting.displayOptionalInputMethod((err) => {
inputMethodSetting.displayOptionalInputMethod((err) => {
if (err) {
console.error('displayOptionalInputMethod failed because: ' + JSON.stringify(err));
return;
......@@ -1301,7 +1302,7 @@ displayOptionalInputMethod(): Promise&lt;void&gt;
**示例:**
```js
InputMethodSetting.displayOptionalInputMethod().then(() => {
inputMethodSetting.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.
先完成此消息的编辑!
想要评论请 注册