提交 7c3847a7 编写于 作者: E ester.zhou

update docs

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 71bdcef9
# Getting Started with eTS in the Low-Code Approach
> **NOTE**<br/>This feature is supported in DevEco Studio V3.0 Beta3 and later versions.
> **NOTE**
>
> This feature is supported in DevEco Studio V3.0 Beta3 and later versions.
>
> The component lineup that supports low-code development in eTS is now at its preliminary stage and will be expanding in coming versions.
>
......@@ -15,7 +17,7 @@ You can develop applications or services in the low-code approach using either o
- Create a project that supports low-code development. This method is used as an example in this topic.
- In an existing project, create a .visual file for development.
- In an existing project, create a .visual file for development. For details, see [Creating a .visual File That Supports Low-Code Development](#building-the-second-page).
## Creating a Project That Supports Low-Code Development
......
# Getting Started with JavaScript in the Low-Code Approach
> **NOTE**<br/>This feature will be available in DevEco Studio V2.2 Beta1 and later versions.
> **NOTE**
>
> This feature will be available in DevEco Studio V2.2 Beta1 and later versions.
>
> For best possible results, use [DevEco Studio V3.0.0.900 Beta3](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta_openharmony) for your development.
......@@ -13,7 +15,7 @@ You can develop applications or services in the low-code approach using either o
- Create a project that supports low-code development. This method is used as an example in this topic.
- In an existing project, create a Visual file for development.
- In an existing project, create a Visual file for development. For details, see [Creating a .visual File That Supports Low-Code Development](#building-the-second-page).
## Creating a Project That Supports Low-Code Development
......
# Environment
This module provides JS APIs for obtaining the root directories of the storage and public files.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module are system APIs and cannot be called by third-party applications.
This module provides JS APIs for obtaining the root directories of the storage and public files.
## Modules to Import
```js
......
# Input Method Framework
> **NOTE**<br>The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> **NOTE**
>
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
......@@ -14,31 +15,31 @@ import inputMethod from '@ohos.inputMethod';
Provides the constants.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| MAX_TYPE_NUM | number | Yes| No| Maximum number of supported input methods.|
## InputMethodProperty<sup>6+</sup><a name="InputMethodProperty"></a>
## InputMethodProperty<sup>6+</sup>
Describes the input method application attributes.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| packageName | string | Yes| No| Package name.|
| methodId | string | Yes| No| Ability name.|
## inputMethod.getInputMethodController<a name="getInputMethodController"></a>
## inputMethod.getInputMethodController
getInputMethodController(): InputMethodController
Obtains an [InputMethodController](#InputMethodController) instance.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Return value**
......@@ -48,17 +49,17 @@ Obtains an [InputMethodController](#InputMethodController) instance.
**Example**
```js
```js
var InputMethodController = inputMethod.getInputMethodController();
```
```
## inputMethod.getInputMethodSetting<sup>6+</sup><a name="getInputMethodSetting"></a>
## inputMethod.getInputMethodSetting<sup>6+</sup>
getInputMethodSetting(): InputMethodSetting
Obtains an [InputMethodSetting](#InputMethodSetting) instance.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Return value**
......@@ -69,10 +70,10 @@ Obtains an [InputMethodSetting](#InputMethodSetting) instance.
**Example**
```js
var InputMethodSetting = inputMethod.getInputMethodSetting();
var InputMethodSetting = inputMethod.getInputMethodSetting();
```
## InputMethodController<a name="InputMethodController"></a>
## InputMethodController
In the following API examples, you must first use [getInputMethodController](#getInputMethodController) to obtain an **InputMethodController** instance, and then call the APIs using the obtained instance.
......@@ -82,7 +83,7 @@ stopInput(callback: AsyncCallback&lt;boolean&gt;): void
Hides the keyboard. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -104,7 +105,7 @@ stopInput(): Promise&lt;boolean&gt;
Hides the keyboard. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Return value**
......@@ -120,7 +121,7 @@ Hides the keyboard. This API uses an asynchronous callback to return the result.
console.info('stopInput isSuccess = ' + isSuccess);
```
## InputMethodSetting<sup>6+</sup><a name="InputMethodSetting"></a>
## InputMethodSetting<sup>6+</sup>
In the following API examples, you must first use [getInputMethodSetting](#getInputMethodSetting) to obtain an **InputMethodSetting** instance, and then call the APIs using the obtained instance.
......@@ -130,7 +131,7 @@ listInputMethod(callback: AsyncCallback&lt;Array&lt;InputMethodProperty&gt;&gt;)
Obtains the list of installed input methods. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -140,14 +141,14 @@ Obtains the list of installed input methods. This API uses an asynchronous callb
**Example**
```js
```js
InputMethodSetting.listInputMethod((properties)=>{
for (var i = 0;i < properties.length; i++) {
var property = properties[i];
console.info(property.packageName + "/" + property.methodId);
}
});
```
```
### listInputMethod
......@@ -155,7 +156,7 @@ listInputMethod(): Promise&lt;Array&lt;InputMethodProperty&gt;&gt;
Obtains the list of installed input methods. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Return value**
......@@ -179,7 +180,7 @@ displayOptionalInputMethod(callback: AsyncCallback&lt;void&gt;): void
Displays a dialog box for selecting an input method. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
- Parameters
......@@ -200,7 +201,7 @@ displayOptionalInputMethod(): Promise&lt;void&gt;
Displays a dialog box for selecting an input method. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Return value**
......
# Input Method Engine
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
......@@ -13,7 +14,7 @@ import inputMethodEngine from '@ohos.inputMethodEngine';
Defines constant values.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
......@@ -50,7 +51,7 @@ getInputMethodEngine(): InputMethodEngine
Obtains an **InputMethodEngine** instance.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Return value**
......@@ -70,7 +71,7 @@ createKeyboardDelegate(): KeyboardDelegate
Obtains a **KeyboardDelegate** instance.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Return value**
......@@ -94,7 +95,7 @@ on(type: 'inputStart', callback: (kbController: KeyboardController, textInputCli
Listens for the input method binding event. This API uses a callback to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -118,7 +119,7 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputC
Cancels listening for the input method binding event.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -139,7 +140,7 @@ on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void
Listens for an input method event.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -162,7 +163,7 @@ off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void
Cancels listening for an input method event.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -187,7 +188,7 @@ on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void
Listens for a hard keyboard even. This API uses a callback to return the key information.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -210,7 +211,7 @@ off(type: 'keyDown'|'keyUp', callback?: (event: KeyEvent) => boolean): void
Cancels listening for a hard keyboard even.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -231,7 +232,7 @@ on(type: 'cursorContextChange', callback: (x: number, y:number, height:number) =
Listens for cursor context changes. This API uses a callback to return the cursor information.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -254,7 +255,7 @@ off(type: 'cursorContextChange', callback?: (x: number, y:number, height:number)
Cancels listening for cursor context changes.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -275,7 +276,7 @@ on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegi
Listens for text selection changes. This API uses a callback to return the text selection information.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -298,7 +299,7 @@ off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBe
Cancels listening for text selection changes.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -320,7 +321,7 @@ on(type: 'textChange', callback: (text: string) => void): void
Listens for text changes. This API uses a callback to return the current text content.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -343,7 +344,7 @@ off(type: 'textChange', callback?: (text: string) => void): void
Cancels listening for text changes.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -368,7 +369,7 @@ hideKeyboard(callback: AsyncCallback&lt;void&gt;): void
Hides the keyboard. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -390,7 +391,7 @@ hideKeyboard(): Promise&lt;void&gt;
Hides the keyboard. This API uses a promise to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Return value**
......@@ -415,7 +416,7 @@ getForward(length:number, callback: AsyncCallback&lt;string&gt;): void
Obtains the specific-length text before the cursor. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -438,7 +439,7 @@ getForward(length:number): Promise&lt;string&gt;
Obtains the specific-length text before the cursor. This API uses a promise to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -465,7 +466,7 @@ getBackward(length:number, callback: AsyncCallback&lt;string&gt;): void
Obtains the specific-length text after the cursor. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -488,7 +489,7 @@ getBackward(length:number): Promise&lt;string&gt;
Obtains the specific-length text after the cursor. This API uses a promise to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -515,7 +516,7 @@ deleteForward(length:number, callback: AsyncCallback&lt;boolean&gt;): void
Deletes the fixed-length text before the cursor. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -538,7 +539,7 @@ deleteForward(length:number): Promise&lt;boolean&gt;
Deletes the fixed-length text before the cursor. This API uses a promise to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -565,7 +566,7 @@ deleteBackward(length:number, callback: AsyncCallback&lt;boolean&gt;): void
Deletes the fixed-length text after the cursor. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -588,7 +589,7 @@ deleteBackward(length:number): Promise&lt;boolean&gt;
Deletes the fixed-length text after the cursor. This API uses a promise to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -615,7 +616,7 @@ sendKeyFunction(action:number, callback: AsyncCallback&lt;boolean&gt;): void
Sets the Enter key to send the text to its target. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -638,7 +639,7 @@ sendKeyFunction(action:number): Promise&lt;boolean&gt;
Sets the Enter key to send the text to its target. This API uses a promise to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -665,7 +666,7 @@ insertText(text:string, callback: AsyncCallback&lt;boolean&gt;): void
Inserts text. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -688,7 +689,7 @@ insertText(text:string): Promise&lt;boolean&gt;
Inserts text. This API uses a promise to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -715,7 +716,7 @@ getEditorAttribute(callback: AsyncCallback&lt;EditorAttribute&gt;): void
Obtains the attribute of the edit box. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
......@@ -736,7 +737,7 @@ getEditorAttribute(): Promise&lt;EditorAttribute&gt;
Obtains the attribute of the edit box. This API uses a promise to return the result.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Return value**
......@@ -754,7 +755,7 @@ var EditorAttribute = TextInputClient.getEditorAttribute();
Describes the attribute of the edit box.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
| Name | Type| Readable| Writable| Description |
| ------------ | -------- | ---- | ---- | ------------------ |
......@@ -765,7 +766,7 @@ Describes the attribute of the edit box.
Describes the attribute of a key.
**System capability**: SystemCapability.Miscservices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
| Name | Type| Readable| Writable| Description |
| --------- | -------- | ---- | ---- | ------------ |
......
......@@ -66,7 +66,7 @@ Registers a callback with the corresponding query condition by using the handle.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------------------------------- | ---- | ---------------- |
| type | string | Yes | Must enter the string **change**.|
| type | string | Yes | Must enter the string **'change'**.|
| callback | Callback&lt;MediaQueryResult&gt; | Yes | Callback registered with media query. |
**Example**
......@@ -91,7 +91,7 @@ Deregisters a callback with the corresponding query condition by using the handl
```js
import mediaquery from '@ohos.mediaquery'
listener = mediaquery.matchMediaSync('(orientation: landscape)'); // Listen for landscape events.
let listener = mediaquery.matchMediaSync('(orientation: landscape)'); // Listen for landscape events.
function onPortrait(mediaQueryResult) {
if (mediaQueryResult.matches) {
// do something here
......
......@@ -182,7 +182,7 @@ Subscribes to the **headerReceive** event, which is triggered when an HTTP respo
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| type | string | Yes | Type of the event to subscribe to. The value is **headerReceive** (response header). |
| type | string | Yes | Type of the event to subscribe to. The value is **'headerReceive'** (response header). |
| callback | function | Yes | Callback for the HTTP Response Header event. |
Parameters of the callback function
......@@ -215,7 +215,7 @@ Unsubscribes from the upload progress event. This API uses an asynchronous callb
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| type | string | Yes | Type of the event to unsubscribe from. The value is **progress** (upload progress). |
| type | string | Yes | Type of the event to unsubscribe from. The value is **'progress'** (upload progress). |
| callback | function | No | Callback for the upload progress event. |
Parameters of the callback function
......@@ -249,7 +249,7 @@ Unsubscribes from the **headerReceive** event. This API uses an asynchronous cal
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| type | string | Yes | Type of the event to unsubscribe from. The value is **headerReceive** (response header). |
| type | string | Yes | Type of the event to unsubscribe from. The value is **'headerReceive'** (response header). |
| callback | function | No | Callback for the HTTP Response Header event. |
Parameters of the callback function
......@@ -452,7 +452,7 @@ Subscribes to the download progress event. This API uses an asynchronous callbac
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| type | string | Yes | Type of the event to subscribe to. The value is **progress** (download progress). |
| type | string | Yes | Type of the event to subscribe to. The value is **'progress'** (download progress). |
| callback | function | Yes | Callback for the download progress event. |
Parameters of the callback function
......@@ -487,7 +487,7 @@ Unsubscribes from the download progress event. This API uses an asynchronous cal
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| type | string | Yes | Type of the event to unsubscribe from. The value is **progress** (download progress). |
| type | string | Yes | Type of the event to unsubscribe from. The value is **'progress'** (download progress). |
| callback | function | No | Callback for the download progress event. |
Parameters of the callback function
......@@ -522,7 +522,7 @@ Subscribes to a download event. This API uses an asynchronous callback to return
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| type | string | Yes | Event type.<br/>- **complete**: download task completion event.<br/>- **pause**: download task pause event.<br/>- **remove**: download task removal event. |
| type | string | Yes | Event type.<br/>- **'complete'**: download task completion event.<br/>- **'pause'**: download task pause event.<br/>- **'remove'**: download task removal event. |
| callback | function | Yes | Callback used to return the result. |
**Example**
......@@ -550,7 +550,7 @@ Unsubscribes from the download event. This API uses an asynchronous callback to
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| type | string | Yes | Event type.<br/>- **complete**: download task completion event.<br/>- **pause**: download task pause event.<br/>- **remove**: download task removal event. |
| type | string | Yes | Event type.<br/>- **'complete'**: download task completion event.<br/>- **'pause'**: download task pause event.<br/>- **'remove'**: download task removal event. |
| callback | function | No | Callback used to return the result. |
**Example**
......@@ -578,7 +578,7 @@ Subscribes to the download task failure event. This API uses an asynchronous cal
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| type | string | Yes | Type of the subscribed event. The value is **fail** (download failure). |
| type | string | Yes | Type of the subscribed event. The value is **'fail'** (download failure). |
| callback | function | Yes | Callback for the download task failure event. |
Parameters of the callback function
......@@ -612,7 +612,7 @@ Unsubscribes from the download task failure event. This API uses an asynchronous
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| type | string | Yes | Type of the event to unsubscribe from. The value is **fail** (download failure). |
| type | string | Yes | Type of the event to unsubscribe from. The value is **'fail'** (download failure). |
| callback | function | No | Callback for the download task failure event. |
Parameters of the callback function
......@@ -948,7 +948,7 @@ Resumes this download task. This API uses an asynchronous callback to return the
| enableMetered | boolean | No | Download allowed in metered connections. |
| enableRoaming | boolean | No | Download allowed on a roaming network. |
| description | string | No | Description of the download session. |
| filePath<sup>7+</sup> | string | No | Download path. (The default path is [ERROR:Invalid link:en-us_topic_0000001135742582.xml#xref8132147102215,link:en-us_topic_0000001127125012.xml#section1856519365229](en-us_topic_0000001127125012.xml#section1856519365229)).<br/>- filePath:'workspace/test.txt': The **workspace** directory is created in the default path to store files.<br/>- filePath:'test.txt': Files are stored in the default path.<br/>- filePath:'workspace/': The **workspace** directory is created in the default path to store files. |
| filePath<sup>7+</sup> | string | No | Download path. (The default path is **'internal://cache/'**.<br/>- filePath:'workspace/test.txt': The **workspace** directory is created in the default path to store files.<br/>- filePath:'test.txt': Files are stored in the default path.<br/>- filePath:'workspace/': The **workspace** directory is created in the default path to store files. |
| networkType | number | No | Network type allowed for download. |
| title | string | No | Title of the download session. |
......
# Search
> **NOTE**<br>
> **NOTE**
>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
The **\<Search>** component provides an input area for users to search.
......@@ -23,7 +24,7 @@ Search(options?: { value?: string; placeholder?: string; icon?: string; controll
| -------- | -------- | -------- | -------- | -------- |
| value | string | No| - | Text input in the search text box. |
| placeholder | string | No | - | Text displayed when there is no input. |
| icon | string | No| - | Path to the search icon. By default, the system search icon is used. The supported icon formats are svg, jpg, and png. |
| icon | string | No| - | Path to the search icon. By default, the system search icon is used. The supported icon formats are .svg, .jpg, and .png. |
| controller | SearchController | No| - | Controller. |
......@@ -35,27 +36,26 @@ Search(options?: { value?: string; placeholder?: string; icon?: string; controll
| placeholderColor | [ResourceColor](../../ui/ts-types.md) | - | Placeholder text color. |
| placeholderFont | [Font](../../ui/ts-types.md) | - | Placeholder text style. |
| textFont | [Font](../../ui/ts-types.md) | - | Text font for the search text box. |
| copyOption<sup>9+</sup> | boolean\|[CopyOption](ts-basic-components-text.md) | true | Whether copy and paste is allowed. |
## Events
| Name | Description |
| -------- | -------- |
| onSubmit(callback: (value: string) => void) | Triggered when users click the search icon or the search button, or tap 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.<br> -**value**: text copied. |
| onCut(callback: (value: string) => void) | Triggered when data is cut from the pasteboard.<br> -**value**: text cut. |
| onPaste(callback: (value: string) => void) | Triggered when data is pasted from the pasteboard.<br> -**value**: text pasted. |
| onSubmit(callback: (value: string) => void) | Triggered when users click the search icon or the search button, or tap 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.<br> - **value**: text copied. |
| onCut(callback: (value: string) => void) | Triggered when data is cut from the pasteboard.<br> - **value**: text cut. |
| onPaste(callback: (value: string) => void) | Triggered when data is pasted from the pasteboard.<br> - **value**: text pasted. |
## SearchController
Defines the controller of the **\<Search>** component.
#### Objects to Import
### Objects to Import
```
controller: SearchController = new SearchController()
```
#### caretPosition
### caretPosition
caretPosition(value: number): void
......
# Refresh
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
The **<Refresh\>** component is used to refresh a page through a pull-down gesture.
> **NOTE**
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
## Required Permissions
None
......@@ -15,7 +15,7 @@ This component supports only one child component.
## APIs
Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number\}\)
Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number | string\}\)
- Parameters
......@@ -23,7 +23,7 @@ Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number\}\)
| -------- | -------- | -------- | -------- | -------- |
| refreshing | boolean | Yes| - | Whether the current component is being refreshed.|
| offset | Length | No| 16 | Distance to the top of the parent component from the **<Refresh\>** component that comes to rest after a successful pull-down gesture.|
| friction | number | No| 62 | Coefficient of friction, which indicates the **<Refresh\>** component's sensitivity to the pull-down gesture. The value ranges from 0 to 100. <br/>- **0** indicates that the **<Refresh\>** component is not sensitive to the pull-down gesture. <br/>- **100** indicates that the **<Refresh\>** component is highly sensitive to the pull-down gesture. <br/>- A larger value indicates a more sensitive response of the **<Refresh\>** component to the pull-down gesture.|
| friction | number \| string | No| 62 | Coefficient of friction, which indicates the **<Refresh\>** component's sensitivity to the pull-down gesture. The value ranges from 0 to 100. <br/>- **0** indicates that the **<Refresh\>** component is not sensitive to the pull-down gesture. <br/>- **100** indicates that the **<Refresh\>** component is highly sensitive to the pull-down gesture. <br/>- A larger value indicates a more sensitive response of the **<Refresh\>** component to the pull-down gesture.|
......
......@@ -13,7 +13,7 @@ To use online videos, you need to add the **ohos.permission.INTERNET** permissio
"abilities":[
{
...
"permissions": ["ohos.permission.INTERNET],
"permissions": ["ohos.permission.INTERNET"],
...
}
]
......@@ -166,7 +166,6 @@ struct VideoCreateComponent {
@State autoPlays: boolean = false;
@State controlsss: boolean = true;
controller: VideoController = new VideoController();
@State startStaus: boolean = true;
build() {
Column() {
Video({
......
# Transition of Shared Elements
Shared element transition can be used for transition between pages, for example, transition from an image on the current page to the next page.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**
> This animationis supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
Shared element transition can be used for transition between pages, for example, transition from an image on the current page to the next page.
## Type
| Name | Type | Default Value | Description |
| Name | Type | Default Value | Description |
| -------- | -------- | -------- | -------- |
| sharedTransition | id: string,<br/>options?: Object | - | If the same ID is configured for a component on the two pages, this shared component is transited. If this parameter is set to an empty string, no shared elements are transited. |
......@@ -31,8 +29,6 @@ The example shows the transition of a shared element from a page and page B.
@Entry
@Component
struct SharedTransitionExample {
@State scale: number = 1
@State opacity: number = 1
@State active: boolean = false
build() {
......@@ -55,7 +51,6 @@ struct SharedTransitionExample {
}
```
```
// PageB
@Entry
......
......@@ -2,6 +2,7 @@
> **NOTE**
>
> This event is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
......@@ -12,12 +13,12 @@ None
## Events
| Name | Bubble Supported | Description |
| Name | Bubbling Supported | Description |
| -------- | -------- | -------- |
| onClick(callback: (event?: ClickEvent) =&gt; void) | No | Called when a click event occurs. For details about the event parameters, see [ClickEvent](#clickevent). |
### ClickEvent
## ClickEvent
| Name | Type | Description |
| -------- | -------- | -------- |
......@@ -25,30 +26,30 @@ None
| screenY | number | Y coordinate of the click relative to the upper edge of the screen. |
| x | number | X coordinate of the click relative to the left edge of the component being clicked. |
| y | number | Y coordinate of the click relative to the upper edge of the component being clicked. |
| target<sup>8+</sup> | EventTarget | Target element that is clicked. |
| target<sup>8+</sup> | [EventTarget](#eventtarget8) | Target element that is clicked. |
| timestamp | number | Timestamp of the event. |
- EventTarget<sup>8+</sup> attributes
## EventTarget<sup>8+</sup>
| Name | Type | Description |
| -------- | -------- | -------- |
| area | Area | Area information of the target element.|
| Name | Type | Description |
| -------- | -------- | -------- |
| area | [Area](#area8) | Area information of the target element.|
- Area<sup>8+</sup> attributes
## Area<sup>8+</sup>
| Name | Type | Description |
| -------- | -------- | -------- |
| width | number | Width of the target element, in vp. |
| height | number | Height of the target element, in vp. |
| position | Position | Position of the upper left corner of the target element relative to that of the parent element. |
| globalPosition | Position | Position of the upper left corner of the target element relative to that of the page. |
| Name | Type | Description |
| -------- | -------- | -------- |
| width | number | Width of the target element, in vp. |
| height | number | Height of the target element, in vp. |
| position | [Position](#position8) | Position of the upper left corner of the target element relative to that of the parent element. |
| globalPosition | [Position](#position8) | Position of the upper left corner of the target element relative to that of the page. |
- Position<sup>8+</sup> attributes
## Position<sup>8+</sup>
| Name | Type | Description |
| -------- | -------- | -------- |
| x | number | X-coordinate, in vp. |
| y | number | Y-coordinate, in vp. |
| Name | Type | Description |
| -------- | -------- | -------- |
| x | number | X-coordinate, in vp. |
| y | number | Y-coordinate, in vp. |
## Example
......
# Drag/Drop Event
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**
>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
| Name | Bubble Supported | Description |
| Name | Bubbling Supported | Description |
| -------- | -------- | -------- |
| onDragStart(callback: (event: [DragEvent](#DragEvent), extraParams?: string) =&gt;\|[Custom Builder](../../ui/ts-types.md)) | No | Triggered when the component bound to the event is dragged for the first time.<br/>-**event**: information about the drag event, including the coordinates of the item that is being dragged.<br/>-**extraParams**: additional information about the drag event. For details, see extraParam.<br/>Return value: object being dragged, which is used for prompts displayed when the object is dragged.<br/>> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>> - A drag event can be triggered by a 150 ms long press.<br/>> <br/>> - If the duration of a long-press gesture is set to less than or equal to 150 ms, the callback for the long-press gesture takes precedence. Otherwise, the callback for the drag event takes precedence. |
| onDragEnter(callback: (event: [DragEvent](#DragEvent), extraParams?: string) =&gt; void) | No | Triggered when the dragged item enters a valid drop target.<br/>-**event**: information about the drag event, including the coordinates of the item that is being dragged.<br/>-**extraParams**: additional information about the drag event. For details, see extraParam.<br/>> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>> This event is valid only when the **onDrop** event is listened to. |
| onDragMove(callback: (event: [DragEvent](#DragEvent), extraParams?: string) =&gt; void) | No | Triggered when the dragged item moves in a valid drop target.<br/>-**event**: information about the drag event, including the coordinates of the item that is being dragged.<br/>-**extraParams**: additional information about the drag event. For details, see extraParam.<br/>> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>> This event is valid only when the **onDrop** event is listened to. |
| onDragLeave(callback: (event: [DragEvent](#DragEvent), extraParams?: string) =&gt; void) | No | Triggered when the dragged item leaves a valid drop target.<br/>-**event**: information about the drag event, including the coordinates of the item that is being dragged.<br/>-**extraParams**: additional information about the drag event. For details, see extraParam.<br/>> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>> This event is valid only when the **onDrop** event is listened to. |
| onDrop(callback: (event:[DragEvent](#DragEvent), extraParams?: string) =&gt; void) | No | Triggered when the dragged item is dropped on a valid drop target.<br/>-**event**: information about the drag event, including the coordinates of the item that is being dragged.<br/>-**extraParams**: additional information about the drag event. For details, see extraParam. |
| onDragStart(callback: (event: DragEvent, extraParams?: string) =&gt;\|[Custom Builder](../../ui/ts-types.md)) | No | Triggered when the component bound to the event is dragged for the first time.<br/>- **event**: information about the drag event, including the coordinates of the item that is being dragged.<br/>- **extraParams**: additional information about the drag event. For details, see **extraParam**.<br/>Return value: object being dragged, which is used for prompts displayed when the object is dragged.<br/>A drag event can be triggered by a 150 ms long press.<br/>If the duration of a long-press gesture is set to less than or equal to 150 ms, the callback for the long-press gesture takes precedence. Otherwise, the callback for the drag event takes precedence. |
| onDragEnter(callback: (event: DragEvent, extraParams?: string) =&gt; void) | No | Triggered when the dragged item enters a valid drop target.<br/>- **event**: information about the drag event, including the coordinates of the item that is being dragged.<br/>- **extraParams**: additional information about the drag event. For details, see **extraParam**.<br/>This event is valid only when the **onDrop** event is listened to. |
| onDragMove(callback: (event: DragEvent, extraParams?: string) =&gt; void) | No | Triggered when the dragged item moves in a valid drop target.<br/>- **event**: information about the drag event, including the coordinates of the item that is being dragged.<br/>- **extraParams**: additional information about the drag event. For details, see **extraParam**.<br/>This event is valid only when the **onDrop** event is listened to. |
| onDragLeave(callback: (event: DragEvent, extraParams?: string) =&gt; void) | No | Triggered when the dragged item leaves a valid drop target.<br/>- **event**: information about the drag event, including the coordinates of the item that is being dragged.<br/>- **extraParams**: additional information about the drag event. For details, see **extraParam**.<br/>This event is valid only when the **onDrop** event is listened to. |
| onDrop(callback: (event:DragEvent, extraParams?: string) =&gt; void) | No | Triggered when the dragged item is dropped on a valid drop target.<br/>- **event**: information about the drag event, including the coordinates of the item that is being dragged.<br/>- **extraParams**: additional information about the drag event. For details, see **extraParam**. |
- extraParam
Returns additional information required for dragging an item.
**extraParam** is a string converted from a JSON object. You can obtain the following attributes using the JSON object converted from **Json.parse**.
| Name | Type | Description |
| -------- | -------- | -------- |
| selectedIndex | number | Index of the dragged item in the parent container. The value of **selectedindex** starts from **0**.<br/>> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>> This attribute is valid only in the **ListItem** component. |
| insertIndex | number | Index of the element into which the dragged item is dropped in the **List** component. The value of **insertIndex** starts from **0**.<br/>> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>> This attribute is valid only in the drag event of the **List** component. |
| selectedIndex | number | Index of the dragged item in the parent container. The value of **selectedIndex** starts from **0**.<br/>This attribute is valid only in the **\<ListItem>** component. |
| insertIndex | number | Index of the element into which the dragged item is dropped in the **List** component. The value of **insertIndex** starts from **0**.<br/>This attribute is valid only in the drag event of the **\<List>** component. |
### DragEvent
- APIs
| Name | Return Value Type | Description |
| -------- | -------- | -------- |
| getX() | number | X-coordinate of the item that is being dragged, in vp. |
| getY() | number | Y-coordinate of the item that is being dragged, in vp. |
| Name | Return Value Type | Description |
| -------- | -------- | -------- |
| getX() | number | X-coordinate of the item that is being dragged, in vp. |
| getY() | number | Y-coordinate of the item that is being dragged, in vp. |
## Example
```
```ts
// xxx.ets
@Entry
@Component
struct DragExample {
......
# Key Event
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> This method is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
> **NOTE**
>
> This event is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Required Permissions
......@@ -12,20 +13,20 @@ None
## Events
| Name | Bubble Supported | Description |
| Name | Bubbling Supported | Description |
| -------- | -------- | -------- |
| onKeyEvent(event: (event?: KeyEvent) =&gt; void) | Yes | Called when a key event occurs. For details about the event parameters, see [KeyEvent Object](#KeyEvent Object). |
### KeyEvent Object
## KeyEvent
- Attributes
| Name | Type | Description |
| -------- | -------- | -------- |
| type | KeyType | Type of a key. |
| type | [KeyType](#keytype-enums) | Type of a key. |
| keyCode | number | Key code. |
| keyText | string | Key value. |
| keySource | KeySource | Type of the input device that triggers the key event. |
| keySource | [KeySource](#keysource-enums) | Type of the input device that triggers the key event. |
| deviceId | number | ID of the input device that triggers the key event. |
| metaKey | number | State of the metakey when the key is pressed. The value **1** means the pressed state, and **0** means the unpressed state. |
| timestamp | number | Timestamp when the key is pressed. |
......@@ -35,35 +36,38 @@ None
| -------- | -------- |
| stopPropagation(): void | Stops the event from bubbling upwards or downwards. |
- KeyType enums
| Name | Description |
| -------- | -------- |
| Down | The key is pressed. |
| Up | The key is released. |
## KeyType Enums
| Name | Description |
| -------- | -------- |
| Down | The key is pressed. |
| Up | The key is released. |
- KeySource enums
| Name | Description |
| -------- | -------- |
| Unknown | Unknown input device. |
| Keyboard | The input device is a keyboard. |
- Common KeyCode description
| Value | Behavior | Physical Button |
| -------- | -------- | -------- |
| 19 | Upward | Up button. |
| 20 | Downward | Down button. |
| 21 | Leftward | Left button. |
| 22 | Rightward | Right button. |
| 23 | OK | **OK** key on a remote control. |
| 66 | OK | **Enter** key on a keyboard. |
| 160 | OK | **Enter** button on the numeric keypad. |
## KeySource Enums
| Name | Description |
| -------- | -------- |
| Unknown | Unknown input device. |
| [KeyCode](#common-keycode-enums) | The input device is a keyboard. |
## Common KeyCode Enums
| Value | Behavior | Physical Button |
| -------- | -------- | -------- |
| 19 | Upward | Up button. |
| 20 | Downward | Down button. |
| 21 | Leftward | Left button. |
| 22 | Rightward | Right button. |
| 23 | OK | **OK** key on a remote control. |
| 66 | OK | **Enter** key on a keyboard. |
| 160 | OK | **Enter** button on the numeric keypad. |
## Example
```
```ts
// xxx.ets
@Entry
@Component
struct KeyEventExample {
......
......@@ -2,6 +2,7 @@
> **NOTE**
>
> This event is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
......@@ -12,46 +13,44 @@ None
## Events
| Name | Pop-up | Description |
| Name | Bubbling Supported | Description |
| -------- | -------- | -------- |
| onTouch(callback: (event?: TouchEvent) =&gt; void) | Yes | Invoked when a touch action is triggered. For details about the event parameters, see [TouchEvent](#touchevent). |
| onTouch(callback: (event?: TouchEvent) =&gt; void) | Yes | Invoked when a touch action is triggered. For details about **event**, see [TouchEvent](#touchevent). |
### TouchEvent
## TouchEvent
- Attributes
| Name | Type | Description |
| -------- | -------- | -------- |
| type | TouchType | Type of a touch event. |
| touches | Array&lt;TouchObject&gt; | All finger information. |
| changedTouches | Array&lt;TouchObject&gt; | Finger information changed. |
| touches | Array&lt;[TouchObject](#touchobject)&gt; | All finger information. |
| changedTouches | Array&lt;[TouchObject](#touchobject)&gt; | Finger information changed. |
| timestamp | number | Timestamp of the event. |
| target<sup>8+</sup> | [EventTarget](ts-universal-events-click.md) | Target of the event. |
| target<sup>8+</sup> | [EventTarget](ts-universal-events-click.md#eventtarget8) | Target of the event. |
- APIs
| API | Description |
| -------- | -------- |
| stopPropagation(): void | Pop-up of the stop event. |
| stopPropagation(): void | Bubbling of the stop event. |
- TouchObject
| Name | Type | Description |
| -------- | -------- | -------- |
| type | TouchType | Type of a touch event. |
| id | number | Unique identifier of a finger. |
| screenX | number | X coordinate of the touch point relative to the left edge of the screen. |
| screenY | number | Y coordinate of the touch point relative to the upper edge of the device screen. |
| x | number | X coordinate of the touch point relative to the left edge of the element to touch. |
| y | number | Y coordinate of the touch point relative to the upper edge of the element to touch. |
- TouchType
| Name | Description |
| -------- | -------- |
| Down | Trigger a touch event when a finger is pressed. |
| Up | Trigger a touch event when a finger is lifted. |
| Move | Trigger a touch event when a finger moves on the screen in pressed state. |
| Cancel | Trigger an event when a touch event is canceled. |
## TouchObject
| Name | Type | Description |
| -------- | -------- | -------- |
| type | [TouchType](#touchtype) | Type of a touch event. |
| id | number | Unique identifier of a finger. |
| screenX | number | X coordinate of the touch point relative to the left edge of the screen. |
| screenY | number | Y coordinate of the touch point relative to the upper edge of the device screen. |
| x | number | X coordinate of the touch point relative to the left edge of the element to touch. |
| y | number | Y coordinate of the touch point relative to the upper edge of the element to touch. |
## TouchType
| Name | Description |
| -------- | -------- |
| Down | Trigger a touch event when a finger is pressed. |
| Up | Trigger a touch event when a finger is lifted. |
| Move | Trigger a touch event when a finger moves on the screen in pressed state. |
| Cancel | Trigger an event when a touch event is canceled. |
## Example
......
# Mouse Event
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**
>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
......@@ -12,13 +13,13 @@ None
## Events
| Name | Bubble Supported | Description |
| Name | Bubbling Supported | Description |
| -------- | -------- | -------- |
| onHover(callback: (isHover: boolean) =&gt; void) | No | Triggered when the mouse cursor enters or leaves the component.<br/>**isHover**: whether the mouse cursor hovers over the component. The value **true** means that the mouse cursor enters the component, and the value **false** means that the mouse cursor leaves the component. |
| onMouse(callback: (event?: MouseEvent) =&gt; void) | Yes | Triggered when the component is clicked by a mouse button or the mouse cursor moves on the component. The **event** parameter indicates the timestamp, mouse button, action, coordinates of the clicked point on the entire screen, and coordinates of the clicked point relative to the component when the event is triggered. |
### MouseEvent
## MouseEvent
- Attributes
| Name | Type | Description |
......@@ -28,32 +29,32 @@ None
| screenY | number | Y-coordinate of the clicked point relative to the upper left corner of the screen. |
| x | number | X-coordinate of the clicked point relative to the upper left corner of the component. |
| y | number | Y-coordinate of the clicked point relative to the upper left corner of the component. |
| button | MouseButton | Mouse button. |
| action | MouseAction | Event action. |
| button | [MouseButton](#mousebutton) | Mouse button. |
| action | [MouseAction](#mouseaction) | Event action. |
- MouseButton attributes
| Name | Type | Description |
| -------- | -------- | -------- |
| Left | number | Left mouse button. |
| Right | number | Right mouse button. |
| Middle | number | Middle mouse button. |
| Back | number | Back button on the left of the mouse. |
| Forward | number | Forward button on the left of the mouse. |
| None | number | No button. |
- MouseAction attributes
| Name | Type | Description |
| -------- | -------- | -------- |
| Press | number | The mouse button is pressed. |
| Release | number | The mouse button is released. |
| Move | number | The mouse cursor moves. |
## MouseButton
| Name | Type | Description |
| -------- | -------- | -------- |
| Left | number | Left mouse button. |
| Right | number | Right mouse button. |
| Middle | number | Middle mouse button. |
| Back | number | Back button on the left of the mouse. |
| Forward | number | Forward button on the left of the mouse. |
| None | number | No button. |
## MouseAction
| Name | Type | Description |
| -------- | -------- | -------- |
| Press | number | The mouse button is pressed. |
| Release | number | The mouse button is released. |
| Move | number | The mouse cursor moves. |
## Example
```
```ts
// xxx.ets
@Entry
@Component
struct MouseEventExample {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册