提交 5e5dd64f 编写于 作者: E ester.zhou

Update docs (20477)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 7d157553
......@@ -218,7 +218,12 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallb
Switches to another subtype of the current input method. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.CONNECT_IME_ABILITY<br>**NOTE** <br>- API version 10 and later: This API can be called by system applications and the current input method application.<br>- API version 9: This API can be called by system applications only.
**Required permissions**: ohos.permission.CONNECT_IME_ABILITY
> **NOTE**
>
> - API version 10 and later: This API can be called by system applications and the current input method application.
> - API version 9: This API can be called by system applications only.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
......@@ -274,7 +279,12 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise&lt;boolean&
Switches to another subtype of the current input method. This API uses a promise to return the result.
**Required permissions**: ohos.permission.CONNECT_IME_ABILITY<br>**NOTE** <br>- API version 10 and later: This API can be called by system applications and the current input method application.<br>- API version 9: This API can be called by system applications only.
**Required permissions**: ohos.permission.CONNECT_IME_ABILITY
> **NOTE**
>
> - API version 10 and later: This API can be called by system applications and the current input method application.
> - API version 9: This API can be called by system applications only.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
......@@ -705,7 +715,7 @@ try {
attach(showKeyboard: boolean, textConfig: TextConfig): Promise&lt;void&gt;
Attaches a self-drawing component to the input method. This API uses an asynchronous callback to return the result.
Attaches a self-drawing component to the input method. This API uses a promise to return the result.
An input method can use the features provided by the input method framework only when it has a self-drawing component attached to it.
......@@ -797,7 +807,7 @@ showTextInput(): Promise&lt;void&gt;
Enters the text editing mode. This API uses a promise to return the result.
This API can be called to start the soft keyboard after the editor component is bound to the input method.
This API can be called to start the soft keyboard after the editor component is attached to the input method.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
......
......@@ -504,7 +504,7 @@ This API can be called only by an input method. Only one SOFT_KEYBOARD panel and
| Error Code ID | Error Message |
| ---------- | ----------------------------- |
| 12800004 | not an input method extension |
| 12800004 | not an input method extension. |
**Example**
......@@ -552,7 +552,7 @@ This API can be called only by an input method. Only one SOFT_KEYBOARD panel and
| Error Code ID | Error Message |
| ---------- | ----------------------------- |
| 12800004 | not an input method extension |
| 12800004 | not an input method extension. |
**Example**
......@@ -1147,7 +1147,7 @@ This API does not work on panels in the FLG_FIXED state.
```js
try {
let promise = windowClass.moveTo(300, 300);
let promise = panel.moveTo(300, 300);
promise.then(() => {
console.log('Succeeded in moving the panel.');
}).catch((err) =>{
......@@ -2487,7 +2487,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e
| Error Code ID| Error Message |
| -------- | ------------------------------ |
| 12800003 | Input method client error. |
| 12800003 | input method client error. |
| 12800006 | Input method controller error. |
**Example**
......@@ -2523,7 +2523,7 @@ Describes the attribute of a key.
| Name | Type| Readable| Writable| Description |
| --------- | -------- | ---- | ---- | ------------ |
| keyCode | number | Yes | No | Key value. For detail, see [KeyCode](js-apis-keycode.md#keycode).|
| keyCode | number | Yes | No | Key value. For details, see [KeyCode](js-apis-keycode.md#keycode).|
| keyAction | number | Yes | No | Key event type.<br>- **2**: keydown event.<br>- **3**: keyup event.|
## PanelFlag<sup>10+</sup>
......
......@@ -62,6 +62,9 @@ struct RadioExample {
Column() {
Text('Radio1')
Radio({ value: 'Radio1', group: 'radioGroup' }).checked(true)
.radioStyle({
checkedBackgroundColor: Color.Pink
})
.height(50)
.width(50)
.onChange((isChecked: boolean) => {
......@@ -71,6 +74,9 @@ struct RadioExample {
Column() {
Text('Radio2')
Radio({ value: 'Radio2', group: 'radioGroup' }).checked(false)
.radioStyle({
checkedBackgroundColor: Color.Pink
})
.height(50)
.width(50)
.onChange((isChecked: boolean) => {
......@@ -80,6 +86,9 @@ struct RadioExample {
Column() {
Text('Radio3')
Radio({ value: 'Radio3', group: 'radioGroup' }).checked(false)
.radioStyle({
checkedBackgroundColor: Color.Pink
})
.height(50)
.width(50)
.onChange((isChecked: boolean) => {
......@@ -90,4 +99,4 @@ struct RadioExample {
}
}
```
![](figures/radio.gif)
![radio](figures/radio.gif)
......@@ -66,21 +66,21 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name | Description |
| ----------------------- | ---------------- |
| CONSTANT<sup>10+</sup> | The Cancel button is always displayed.|
| INVISIBLE<sup>10+</sup> | The Cancel button is always hidden.|
| INPUT<sup>10+</sup> | The Cancel button is displayed when there is text input.|
| CONSTANT | The Cancel button is always displayed.|
| INVISIBLE | The Cancel button is always hidden.|
| INPUT | The Cancel button is displayed when there is text input.|
## Events
In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
| Name | Description |
| ---------------------------------------- | ---------------------------------------- |
| onSubmit(callback: (value: string) => void) | Invoked when users click the search icon or the search button, or touch the search button on a soft keyboard.<br> - **value**: current text input.|
| onChange(callback: (value: string) => void) | Invoked when the input in the text box changes.<br> - **value**: current text input. |
| onCopy(callback: (value: string) => void) | Invoked when data is copied to the pasteboard, which is displayed when the search text box is long pressed.<br> - **value**: text copied. |
| onCut(callback: (value: string) => void) | Invoked when data is cut from the pasteboard, which is displayed when the search text box is long pressed.<br> - **value**: text cut. |
| onPaste(callback: (value: string) => void) | Invoked when data is pasted from the pasteboard, which is displayed when the search text box is long pressed.<br> -**value**: text pasted. |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| onSubmit(callback: (value: string) => void) | Triggered when users click the search icon or the search button, or touch the search button on a soft keyboard.<br> - **value**: current text input.|
| onChange(callback: (value: string) => void) | Triggered when the input in the text box changes.<br> - **value**: current text input.|
| onCopy(callback: (value: string) => void) | Triggered when data is copied to the pasteboard, which is displayed when the search text box is long pressed.<br> - **value**: text copied.|
| onCut(callback: (value: string) => void) | Triggered when data is cut from the pasteboard, which is displayed when the search text box is long pressed.<br> - **value**: text cut.|
| onPaste(callback: (value: string) => void) | Triggered when data is pasted from the pasteboard, which is displayed when the search text box is long pressed.<br> -**value**: text pasted.|
## SearchController
......@@ -104,6 +104,8 @@ Sets the position of the caret.
## Example
### Example 1
```ts
// xxx.ets
@Entry
......@@ -119,7 +121,7 @@ struct SearchExample {
Text('onChange:' + this.changeValue).fontSize(18).margin(15)
Search({ value: this.changeValue, placeholder: 'Type to search...', controller: this.controller })
.searchButton('SEARCH')
.width(400)
.width('95%')
.height(40)
.backgroundColor('#F5F5F5')
.placeholderColor(Color.Grey)
......@@ -143,3 +145,43 @@ struct SearchExample {
```
![search](figures/search.gif)
### Example 2
```ts
// xxx.ets
@Entry
@Component
struct SearchButtoonExample {
@State submitValue: string = ''
build() {
Column() {
Text('onSubmit:' + this.submitValue).fontSize(18).margin(15)
Search({ placeholder: 'Type to search...' })
.searchButton('SEARCH')
.searchIcon({
src: $r('app.media.search')
})
.cancelButton({
style: CancelButtonStyle.CONSTANT,
icon: {
src: $r('app.media.cancel')
}
})
.width('90%')
.height(40)
.backgroundColor('#F5F5F5')
.placeholderColor(Color.Grey)
.placeholderFont({ size: 14, weight: 400 })
.textFont({ size: 14, weight: 400 })
.onSubmit((value: string) => {
this.submitValue = value
})
.margin(20)
}.width('100%')
}
}
```
![searchButton](figures/searchButton.gif)
......@@ -29,7 +29,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
## Events
The universal events and gestures are not supported. Only the following events are supported.
In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
| Name| Description|
| -------- | -------- |
......
......@@ -157,7 +157,7 @@ The **Font** type is used to set the text style.
| Name | Type | Mandatory | Description |
| ------ | ---------------------------------------- | ---- | ---------------------------------------- |
| size | [Length](#length) | No | Font size. If the value is of the number type, the unit fp is used. The value cannot be a percentage.|
| weight | [FontWeight](ts-appendix-enums.md#fontweight) \| number \| string | No | Font weight. For the number type, the value ranges from 100 to 900, at an interval of 100. The default value is **400**. A larger value indicates a larger font weight.|
| weight | [FontWeight](ts-appendix-enums.md#fontweight) \| number \| string | No | Font weight. For the number type, the value ranges from 100 to 900, at an interval of 100. The default value is **400**. A larger value indicates a thicker font.|
| family | string \| [Resource](#resource) | No | Font family of the text. Use commas (,) to separate multiple fonts. The priority of the fonts is the sequence in which they are placed. An example value is **'Arial, HarmonyOS Sans'**. Currently, only the **'HarmonyOS Sans'** font is supported.|
| style | [FontStyle](ts-appendix-enums.md#fontstyle) | No | Font style. |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册