提交 bc353f87 编写于 作者: W wusongqing 提交者: Gitee

Merge branch 'OpenHarmony-3.2-Beta2' of gitee.com:openharmony/docs into cherry-pick-1661414262

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
- [@ohos.ability.wantConstant](js-apis-ability-wantConstant.md) - [@ohos.ability.wantConstant](js-apis-ability-wantConstant.md)
- [@ohos.application.abilityDelegatorRegistry](js-apis-abilityDelegatorRegistry.md) - [@ohos.application.abilityDelegatorRegistry](js-apis-abilityDelegatorRegistry.md)
- [@ohos.application.abilityManager](js-apis-application-abilityManager.md) - [@ohos.application.abilityManager](js-apis-application-abilityManager.md)
- [@ohos.application.AccessibilityExtensionAbility](js-apis-accessibility-extension-context.md)
- [@ohos.application.AccessibilityExtensionAbility](js-apis-application-AccessibilityExtensionAbility.md)
- [@ohos.application.appManager](js-apis-appmanager.md) - [@ohos.application.appManager](js-apis-appmanager.md)
- [@ohos.application.Configuration](js-apis-configuration.md) - [@ohos.application.Configuration](js-apis-configuration.md)
- [@ohos.application.ConfigurationConstant](js-apis-configurationconstant.md) - [@ohos.application.ConfigurationConstant](js-apis-configurationconstant.md)
......
# Work Scheduler Callbacks # Work Scheduler Callbacks
> **NOTE**<br/> The **WorkSchedulerExtensionAbility** module provides callbacks for Work Scheduler tasks.
> The initial APIs of this module are supported since API version 9. API version 9 is a canary version for trial use. The APIs of this version may be unstable.
When developing an application, you can override the APIs of this module and add your own task logic to the APIs.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be used only in the stage model.
## Modules to Import ## Modules to Import
``` ```ts
import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility' import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility'
``` ```
...@@ -20,13 +26,13 @@ Triggered when the Work Scheduler task starts. ...@@ -20,13 +26,13 @@ Triggered when the Work Scheduler task starts.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | --------------------- | ---- | -------------- | | ---- | ---------------------------------------- | ---- | -------------- |
| work | [workScheduler.WorkInfo](js-apis-workScheduler.md#workinfo) | Yes | Task to be added to the execution queue.| | work | [workScheduler.WorkInfo](js-apis-workScheduler.md#workinfo) | Yes | Target task. |
**Example** **Example**
``` ```ts
export default class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility { export default class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility {
onWorkStart(workInfo) { onWorkStart(workInfo) {
console.log('MyWorkSchedulerExtensionAbility onWorkStart' + JSON.stringify(workInfo)); console.log('MyWorkSchedulerExtensionAbility onWorkStart' + JSON.stringify(workInfo));
...@@ -44,14 +50,14 @@ Triggered when the Work Scheduler task stops. ...@@ -44,14 +50,14 @@ Triggered when the Work Scheduler task stops.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | --------------------- | ---- | -------------- | | ---- | ---------------------------------------- | ---- | -------------- |
| work | [workScheduler.WorkInfo](js-apis-workScheduler.md#workinfo) | Yes | Task to be added to the execution queue.| | work | [workScheduler.WorkInfo](js-apis-workScheduler.md#workinfo) | Yes | Target task. |
**Example** **Example**
``` ```ts
export default class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility { export default class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility {
onWorkStop(workInfo) { onWorkStop(workInfo) {
console.log('MyWorkSchedulerExtensionAbility onWorkStop' + JSON.stringify(workInfo)); console.log('MyWorkSchedulerExtensionAbility onWorkStop' + JSON.stringify(workInfo));
......
# AccessibilityExtensionContext
The **AccessibilityExtensionContext** module, inherited from **ExtensionContext**, provides context for **Accessibility Extension** abilities.
You can use the APIs of this module to configure the concerned information, obtain root information, and inject gestures.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
## Modules to Import
```js
import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility'
```
## FocusDirection
Enumerates the focus directions.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
| Name | Description |
| -------- | ------- |
| up | Search for the next focusable item above the current item in focus.|
| down | Search for the next focusable item below the current item in focus.|
| left | Search for the next focusable item on the left of the current item in focus.|
| right | Search for the next focusable item on the right the current item in focus.|
| forward | Search for the next focusable item before the current item in focus.|
| backward | Search for the next focusable item after the current item in focus.|
## FocusType
Enumerates of the focus types.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
| Name | Description |
| ------------- | ----------- |
| accessibility | Accessibility focus.|
| normal | Normal focus. |
## Rect
Defines a rectangle.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name | Type | Readable | Writable | Description |
| ------ | ------ | ---- | ---- | --------- |
| left | number | Yes | No | Left boundary of the rectangle.|
| top | number | Yes | No | Top boundary of the rectangle.|
| width | number | Yes | No | Width of the rectangle. |
| height | number | Yes | No | Height of the rectangle. |
## WindowType
Enumerates the window types.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
| Name | Description |
| ----------- | --------- |
| application | Application window.|
| system | System window.|
## AccessibilityExtensionContext.setEventTypeFilter
setEventTypeFilter(type: Array<accessibility.EventType>): Promise\<boolean>;
Sets the concerned event type.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ---------------------------------------- | ---- | -------- |
| type | Array&lt;[EventType](js-apis-accessibility.md#EventType)&gt; | Yes | Event type.|
**Return value**
| Type | Description |
| ---------------------- | --------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.|
**Example**
```ts
this.context.setEventTypeFilter(['click', 'longClick']);
```
## AccessibilityExtensionContext.setTargetBundleName
setTargetBundleName(targetNames: Array\<string>): Promise\<boolean>;
Sets the concerned target bundle.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name | Type | Mandatory | Description |
| ----------- | ------------------- | ---- | -------- |
| targetNames | Array&lt;string&gt; | Yes | Name of the target bundle.|
**Return value**
| Type | Description |
| ---------------------- | --------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.|
**Example**
```ts
this.context.setTargetBundleName(['com.ohos.mms']);
```
## AccessibilityExtensionContext.getFocusElement
getFocusElement(isAccessibilityFocus?: boolean): Promise\<AccessibilityElement>;
Obtains the focus element.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name | Type | Mandatory | Description |
| -------------------- | ------- | ---- | ------------------- |
| isAccessibilityFocus | boolean | No | Whether the obtained focus element is an accessibility focus. The default value is false.|
**Return value**
| Type | Description |
| ----------------------------------- | ---------------------- |
| Promise&lt;AccessibilityElement&gt; | Promise used to return the current focus element.|
**Example**
```ts
this.context.getFocusElement().then(focusElement => {
console.log("AxExtensionAbility getFocusElement success");
})
```
## AccessibilityExtensionContext.getWindowRootElement
getWindowRootElement(windowId?: number): Promise\<AccessibilityElement>;
Obtains the root element of a window.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------ | ---- | --------------------------- |
| windowId | number | No | Window for which you want to obtain the root element. If this parameter is not specified, it indicates the current active window.|
**Return value**
| Type | Description |
| ----------------------------------- | ----------------------- |
| Promise&lt;AccessibilityElement&gt; | Promise used to return the root element.|
**Example**
```ts
this.context.getWindowRootElement().then(rootElement => {
console.log("AxExtensionAbility getWindowRootElement success");
})
```
## AccessibilityExtensionContext.getWindows
getWindows(displayId?: number): Promise<Array\<AccessibilityElement>>;
Obtains the list of windows visible to users.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ------------------------- |
| displayId | number | No | Screen from which the window information is obtained. If this parameter is not specified, it indicates the default home screen.|
**Return value**
| Type | Description |
| ---------------------------------------- | ------------------------ |
| Promise&lt;Array&lt;AccessibilityElement&gt;&gt; | Promise used to return the window list. |
**Example**
```ts
this.context.getWindows().then(windows => {
console.log("AxExtensionAbility getWindows success");
})
```
## AccessibilityExtensionContext.gestureInject
gestureInject(gesturePath: GesturePath, listener: Callback\<boolean>): Promise\<boolean
Injects a gesture.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name | Type | Mandatory | Description |
| ----------- | ---------------------------------------- | ---- | -------------- |
| gesturePath | [GesturePath](js-apis-application-AccessibilityExtensionAbility.md#GesturePath) | Yes | Path of the gesture to inject. |
| listener | Callback&lt;boolean&gt; | Yes | Callback used to return the result.|
**Return value**
| Type | Description |
| ---------------------- | ---------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.|
**Example**
```ts
let gesturePath = new GesturePath(100);
for (let i = 0; i < 10; i++) {
let gesturePoint = new GesturePosition(100, i * 200);
gesturePath.positions.push(gesturePoint);
}
this.context.gestureInject(gesturePath, (result) => {
console.info('gestureInject result: ' + result);
})
```
# Accessibility Extension Ability
The **AccessibilityExtensionAbility** module is based on the ExtensionAbility framework and provides the **AccessibilityExtensionAbility**.
>**NOTE**
>
>The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
>The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility'
```
## AccessibilityEvent
Defines an accessibility event.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
### Attributes
| Name | Type | Readable | Writable | Description |
| --------- | ---------------------------------------- | ---- | ---- | ---------- |
| eventType | [EventType](js-apis-accessibility.md#EventType) \| [WindowUpdateType](js-apis-accessibility.md#WindowUpdateType) \| [TouchGuideType](touchguidetype) \| [GestureType](gesturetype) \| [PageUpdateType](pageupdatetype) | Yes | No | Event type. |
| target | AccessibilityElement | Yes | No | Target component where the event occurs.|
| timeStamp | number | Yes | No | Timestamp of the event. |
## GesturePath
Defines a gesture path.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
### Attributes
| Name | Type | Readable | Writable | Description |
| ------------ | ---------------------------------------- | ---- | ---- | ------ |
| points | Array&lt;[GesturePoint](gesturepoint)&gt; | Yes | Yes | An array of gesture touch points. |
| durationTime | number | Yes | Yes | Total time consumed by the gesture.|
### constructor
constructor(durationTime: number)
A constructor used to create a **GesturePath** object.
**Parameters**
| Name | Type | Mandatory | Description |
| ------------ | ------ | ---- | ------ |
| durationTime | number | Yes | Total time consumed by the gesture.|
**Example**
```typescript
let gesturePath = new GesturePath(100);
```
## GesturePoint
Defines a gesture touch point.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
### Attributes
| Name | Type | Readable | Writable | Description |
| --------- | ------ | ---- | ---- | ------- |
| positionX | number | Yes | Yes | X-coordinate of the touch point.|
| positionY | number | Yes | Yes | Y-coordinate of the touch point.|
### constructor
constructor(positionX: number, positionY: number)
A constructor used to create a **GesturePoint** object.
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ------- |
| positionX | number | Yes | X-coordinate of the touch point.|
| positionY | number | Yes | Y-coordinate of the touch point.|
**Example**
```typescript
let gesturePoint = new GesturePoint(100, 200);
```
## GestureType
Enumerates gesture types.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
| Name | Description |
| ------------- | ------------ |
| left | Left gesture. |
| leftThenRight | Left-then-right gesture.|
| leftThenUp | Left-then-up gesture.|
| leftThenDown | Left-then-down gesture.|
| right | Right gesture. |
| rightThenLeft | Right-then-left gesture.|
| rightThenUp | Right-then-up gesture.|
| rightThenDown | Right-then-down gesture.|
| up | Up gesture. |
| upThenLeft | Up-then-left gesture.|
| upThenRight | Up-then-right gesture.|
| upThenDown | Up-then-down gesture.|
| down | Down gesture. |
| downThenLeft | Down-then-left gesture.|
| downThenRight | Down-then-right gesture.|
| downThenUp | Down-then-up gesture.|
## PageUpdateType
Enumerates the page refresh types.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
| Name | Description |
| ----------------- | --------- |
| pageContentUpdate | Update of the page content.|
| pageStateUpdate | Update of the page status.|
## TouchGuideType
Enumerates the touch guide event types.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
| Name | Description |
| ---------- | ------------ |
| touchBegin | A touch starts in touch guide mode.|
| touchEnd | A touch ends in touch guide mode.|
## AccessibilityExtensionAbility.onConnect
onConnect(): void;
Called when the **AccessibilityExtensionAbility** is enabled and connected to the system service. In this API, you can initialize service logic. This API can be overridden as required.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
None
**Example**
```ts
onConnect(): void {
console.log("AxExtensionAbility onConnect");
}
```
## AccessibilityExtensionAbility.onDisconnect
onDisconnect(): void;
Called when the **AccessibilityExtensionAbility** is disabled and disconnected from the system service. In this API, you can implement the service logic of resource release and exit. This API can be overridden as required.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
None
**Example**
```ts
onDisconnect(): void {
console.log("AxExtensionAbility onDisconnect");
}
```
## AccessibilityExtensionAbility.onAccessibilityEvent
onAccessibilityEvent(event: AccessibilityEvent): void;
Called when an event that matches the specified bundle and event type occurs. In this API, you can implement event-specific service logic. Generally, this API needs to be overridden.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ---------------------------------------- | ---- | --------------- |
| event | [AccessibilityEvent](accessibilityevent) | Yes | Accessibility event. No value is returned.|
**Example**
```ts
onAccessibilityEvent(event: AccessibilityEvent): void {
console.log("AxExtensionAbility onAccessibilityEvent");
if (event.eventType == 'click') {
console.log("AxExtensionAbility onAccessibilityEvent: click");
}
}
```
## AccessibilityExtensionAbility.onKeyEvent
onKeyEvent(keyEvent: inputEventClient.KeyEvent): boolean;
Called when a physical key is pressed. In this API, you can determine whether to intercept the key event based on the service.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ----------------------- |
| keyEvent | [KeyEvent](js-apis-inputeventclient.md#KeyEvent) | Yes | Key event. If **true** is returned, the key is intercepted.|
**Example**
```ts
onKeyEvent(keyEvent: inputEventClient.KeyEvent): boolean {
console.log("AxExtensionAbility onKeyEvent");
if (keyEvent.keyCode == 22) {
console.log("AxExtensionAbility onKeyEvent: intercept 22");
return true;
}
return false;
}
```
...@@ -691,7 +691,7 @@ This API can be used only in the stage model. ...@@ -691,7 +691,7 @@ This API can be used only in the stage model.
| -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| uri | string | Yes | URI of the file. | | uri | string | Yes | URI of the file. |
| mimeTypeFilter | string | Yes | MIME types to match. Example:<br>**\*/\***: Obtain all supported types.<br>**image/\***: Obtain the MIMEs with the main type of **image**.<br>**\*/jpg**: Obtain the MIMEs with the subtype of **jpg**.| | mimeTypeFilter | string | Yes | MIME types to match. Example:<br>**\*/\***: Obtain all supported types.<br>**image/\***: Obtain the MIMEs with the main type of **image**.<br>**\*/jpg**: Obtain the MIMEs with the subtype of **jpg**.|
| callback | AsyncCallback<Array\<string>> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the MIME types obtained. Otherwise, **err** is an error object.| | callback | AsyncCallback<Array\<string>> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the MIME types obtained. Otherwise, **err** is an error object.|
**Example** **Example**
......
...@@ -100,7 +100,7 @@ Enumerates the key purposes. ...@@ -100,7 +100,7 @@ Enumerates the key purposes.
| Name | Value | Description | | Name | Value | Description |
| ------------------------ | ---- | -------------------------------- | | ------------------------ | ---- | -------------------------------- |
| HUKS_KEY_PURPOSE_ENCRYPT | 1 | Used to encrypt plaintext.| | HUKS_KEY_PURPOSE_ENCRYPT | 1 | Used to encrypt plaintext.|
| HUKS_KEY_PURPOSE_DECRYPT | 2 | Used to decrypt cipher text.| | HUKS_KEY_PURPOSE_DECRYPT | 2 | Used to decrypt the cipher text.|
| HUKS_KEY_PURPOSE_SIGN | 4 | Used to sign data. | | HUKS_KEY_PURPOSE_SIGN | 4 | Used to sign data. |
| HUKS_KEY_PURPOSE_VERIFY | 8 | Used to verify the signed data. | | HUKS_KEY_PURPOSE_VERIFY | 8 | Used to verify the signed data. |
| HUKS_KEY_PURPOSE_DERIVE | 16 | Used to derive a key. | | HUKS_KEY_PURPOSE_DERIVE | 16 | Used to derive a key. |
...@@ -287,12 +287,12 @@ Enumerates the tag data types. ...@@ -287,12 +287,12 @@ Enumerates the tag data types.
| Name | Value | Description | | Name | Value | Description |
| --------------------- | ------- | --------------------------------------- | | --------------------- | ------- | --------------------------------------- |
| HUKS_TAG_TYPE_INVALID | 0 << 28 | Invalid tag type | | HUKS_TAG_TYPE_INVALID | 0 << 28 | Invalid tag type. |
| HUKS_TAG_TYPE_INT | 1 << 28 | Number of the int type | | HUKS_TAG_TYPE_INT | 1 << 28 | Number of the int type. |
| HUKS_TAG_TYPE_UINT | 2 << 28 | Number of the uint type| | HUKS_TAG_TYPE_UINT | 2 << 28 | Number of the uint type.|
| HUKS_TAG_TYPE_ULONG | 3 << 28 | BigInt | | HUKS_TAG_TYPE_ULONG | 3 << 28 | BigInt. |
| HUKS_TAG_TYPE_BOOL | 4 << 28 | Boolean | | HUKS_TAG_TYPE_BOOL | 4 << 28 | Boolean. |
| HUKS_TAG_TYPE_BYTES | 5 << 28 | Uint8Array | | HUKS_TAG_TYPE_BYTES | 5 << 28 | Uint8Array. |
## HuksTag ## HuksTag
...@@ -1198,7 +1198,7 @@ Completes the key operation and releases resources. This API uses a promise to r ...@@ -1198,7 +1198,7 @@ Completes the key operation and releases resources. This API uses a promise to r
| -------- | ---------------------- | ---- | ------------------------------------- | | -------- | ---------------------- | ---- | ------------------------------------- |
| handle | number | Yes | Handle of the **Finish** operation.| | handle | number | Yes | Handle of the **Finish** operation.|
| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation.| | options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation.|
| promise | Promise\<[HuksResult](#HuksResult)> | Yes| Promise used to return the operation result.| | promise | Promise\<[HuksResult](#huksresult)> | Yes| Promise used to return the operation result.|
## huks.abort ## huks.abort
......
...@@ -192,7 +192,7 @@ Represents the permission usage records of all applications. ...@@ -192,7 +192,7 @@ Represents the permission usage records of all applications.
| -------- | -------------- | ---- | ---------------------------------------- | | -------- | -------------- | ---- | ---------------------------------------- |
| beginTime | number | No | Start time of the query, in ms.| | beginTime | number | No | Start time of the query, in ms.|
| endTime | number | No | End time of the query, in ms.| | endTime | number | No | End time of the query, in ms.|
| bundleRecords | Array&lt;[BundleUsedRecord](#BundleUsedRecord)&gt; | No | Permission usage records obtained. | | bundleRecords | Array&lt;[BundleUsedRecord](#bundleusedrecord)&gt; | No | Permission usage records obtained. |
## BundleUsedRecord ## BundleUsedRecord
...@@ -206,7 +206,7 @@ Represents the permission access records of an application. ...@@ -206,7 +206,7 @@ Represents the permission access records of an application.
| isRemote | boolean | No | Whether the token ID belongs to a remote device. The default value is **false**.| | isRemote | boolean | No | Whether the token ID belongs to a remote device. The default value is **false**.|
| deviceId | string | No | ID of the device hosting the target application. | | deviceId | string | No | ID of the device hosting the target application. |
| bundleName | string | No | Bundle name of the target application.| | bundleName | string | No | Bundle name of the target application.|
| permissionRecords | Array&lt;[PermissionUsedRecord](#PermissionUsedRecord)&gt; | No | Permission usage records of the target application. | | permissionRecords | Array&lt;[PermissionUsedRecord](#permissionusedrecord)&gt; | No | Permission usage records of the target application. |
## PermissionUsedRecord ## PermissionUsedRecord
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
## Modules to Import ## Modules to Import
```ts ```ts
import parameter from '@ohos.systemParameter' import parameter from '@ohos.systemparameter'
``` ```
...@@ -216,7 +216,7 @@ Sets a value for the attribute with the specified key. This API uses a promise t ...@@ -216,7 +216,7 @@ Sets a value for the attribute with the specified key. This API uses a promise t
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | string | Yes| Key of the system attribute.| | key | string | Yes| Key of the system attribute.|
| value| string | Yes | System attribute value to set.| | value| string | Yes| System attribute value to set.|
**Return value** **Return value**
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
> - The APIs of this module are no longer maintained since API Version 6, and you are advised to use [`@ohos.data.storage`](js-apis-data-storage.md). From API Version 9, you are advised to use [`@ohos.data.preferences`](js-apis-data-preferences.md). > - The APIs of this module are no longer maintained since API Version 6, and you are advised to use [`@ohos.data.storage`](js-apis-data-storage.md). From API Version 9, you are advised to use [`@ohos.data.preferences`](js-apis-data-preferences.md).
> >
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be used only in the FA model.
## Modules to Import ## Modules to Import
......
# Work Scheduler # Work Scheduler
> **NOTE**<br/> The **workScheduler** module provides the APIs for registering, canceling, and querying Work Scheduler tasks, which do not have real-time constraints.
> The initial APIs of this module are supported since API version 9. API version 9 is a canary version for trial use. The APIs of this version may be unstable.
The system executes Work Scheduler tasks at an appropriate time, subject to the storage space, power consumption, temperature, and more.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be used only in the stage model.
## Modules to Import ## Modules to Import
``` ```js
import workScheduler from '@ohos.workScheduler' import workScheduler from '@ohos.workScheduler'
``` ```
...@@ -31,7 +37,7 @@ Instructs the **WorkSchedulerService** to add the specified task to the executio ...@@ -31,7 +37,7 @@ Instructs the **WorkSchedulerService** to add the specified task to the executio
**Example** **Example**
``` ```js
let workInfo = { let workInfo = {
workId: 1, workId: 1,
batteryLevel:50, batteryLevel:50,
...@@ -67,7 +73,7 @@ Instructs the **WorkSchedulerService** to stop the specified task. ...@@ -67,7 +73,7 @@ Instructs the **WorkSchedulerService** to stop the specified task.
**Example** **Example**
``` ```js
let workInfo = { let workInfo = {
workId: 1, workId: 1,
batteryLevel:50, batteryLevel:50,
...@@ -97,7 +103,7 @@ Obtains the latest task status. This API uses an asynchronous callback to return ...@@ -97,7 +103,7 @@ Obtains the latest task status. This API uses an asynchronous callback to return
**Example** **Example**
``` ```js
workScheduler.getWorkStatus(50, (err, res) => { workScheduler.getWorkStatus(50, (err, res) => {
if (err) { if (err) {
console.info('workschedulerLog getWorkStatus failed, because:' + err.code); console.info('workschedulerLog getWorkStatus failed, because:' + err.code);
...@@ -130,7 +136,7 @@ Obtains the latest task status. This API uses a promise to return the result. ...@@ -130,7 +136,7 @@ Obtains the latest task status. This API uses a promise to return the result.
**Example** **Example**
``` ```js
workScheduler.getWorkStatus(50).then((res) => { workScheduler.getWorkStatus(50).then((res) => {
for (let item in res) { for (let item in res) {
console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]); console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]);
...@@ -151,7 +157,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou ...@@ -151,7 +157,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------------------- | ---- | ------------------------------- | | -------- | -------------------- | ---- | ------------------------------- |
| callback | AsyncCallback\<void> | Yes | Callback used to return all tasks associated with the current application. | | callback | AsyncCallback\<void> | Yes | Callback used to return all tasks associated with the current application.|
**Return value** **Return value**
...@@ -161,7 +167,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou ...@@ -161,7 +167,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou
**Example** **Example**
``` ```js
workScheduler.obtainAllWorks((err, res) =>{ workScheduler.obtainAllWorks((err, res) =>{
if (err) { if (err) {
console.info('workschedulerLog obtainAllWorks failed, because:' + err.code); console.info('workschedulerLog obtainAllWorks failed, because:' + err.code);
...@@ -182,11 +188,11 @@ Obtains all tasks associated with this application. This API uses a promise to r ...@@ -182,11 +188,11 @@ Obtains all tasks associated with this application. This API uses a promise to r
| Type | Description | | Type | Description |
| -------------------------------------- | ------------------------------ | | -------------------------------------- | ------------------------------ |
| Promise<Array\<[WorkInfo](#workinfo)>> | Promise used to return all tasks associated with the current application. | | Promise<Array\<[WorkInfo](#workinfo)>> | Promise used to return all tasks associated with the current application.|
**Example** **Example**
``` ```js
workScheduler.obtainAllWorks().then((res) => { workScheduler.obtainAllWorks().then((res) => {
console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res)); console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res));
}).catch((err) => { }).catch((err) => {
...@@ -203,7 +209,7 @@ Stops and cancels all tasks associated with the current application. ...@@ -203,7 +209,7 @@ Stops and cancels all tasks associated with the current application.
**Example** **Example**
``` ```js
let res = workScheduler.stopAndClearWorks(); let res = workScheduler.stopAndClearWorks();
console.info("workschedulerLog res:" + res); console.info("workschedulerLog res:" + res);
``` ```
...@@ -230,7 +236,7 @@ Checks whether the last execution of the specified task timed out. This API uses ...@@ -230,7 +236,7 @@ Checks whether the last execution of the specified task timed out. This API uses
**Example** **Example**
``` ```js
workScheduler.isLastWorkTimeOut(500, (err, res) =>{ workScheduler.isLastWorkTimeOut(500, (err, res) =>{
if (err) { if (err) {
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code); console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code);
...@@ -261,7 +267,7 @@ Checks whether the last execution of the specified task timed out. This API uses ...@@ -261,7 +267,7 @@ Checks whether the last execution of the specified task timed out. This API uses
**Example** **Example**
``` ```js
workScheduler.isLastWorkTimeOut(500) workScheduler.isLastWorkTimeOut(500)
.then(res => { .then(res => {
console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res); console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res);
...@@ -272,27 +278,27 @@ Checks whether the last execution of the specified task timed out. This API uses ...@@ -272,27 +278,27 @@ Checks whether the last execution of the specified task timed out. This API uses
``` ```
## WorkInfo ## WorkInfo
Provides detailed information about the task. Provides detailed information about the task. For details about the constraints on configuring **WorkInfo**, see [Work Scheduler Overview](../../task-management/work-scheduler-overview.md).
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler **System capability**: SystemCapability.ResourceSchedule.WorkScheduler
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| --------------- | --------------------------------- | ---- | -------------------------------- | | --------------- | --------------------------------- | ---- | ---------------- |
| workId | number | Yes | Task ID. | | workId | number | Yes | Task ID. |
| bundleName | string | Yes | Name of the Work Scheduler task bundle. | | bundleName | string | Yes | Name of the Work Scheduler task bundle. |
| abilityName | string | Yes | Name of the component to be notified by a Work Scheduler callback.| | abilityName | string | Yes | Name of the component to be notified by a Work Scheduler callback.|
| networkType | [NetworkType](#networktype) | No | Network type. | | networkType | [NetworkType](#networktype) | No | Network type. |
| isCharging | boolean | No | Whether the device is charging. | | isCharging | boolean | No | Whether the device is charging. |
| chargerType | [ChargingType](#chargingtype) | No | Charging type. | | chargerType | [ChargingType](#chargingtype) | No | Charging type. |
| batteryLevel | number | No | Battery level. | | batteryLevel | number | No | Battery level. |
| batteryStatus | [BatteryStatus](#batterystatus) | No | Battery status. | | batteryStatus | [BatteryStatus](#batterystatus) | No | Battery status. |
| storageRequest | [StorageRequest](#storagerequest) | No | Storage status. | | storageRequest | [StorageRequest](#storagerequest) | No | Storage status. |
| isRepeat | boolean | No | Whether the task is repeated. | | isRepeat | boolean | No | Whether the task is repeated. |
| repeatCycleTime | number | No | Repeat interval. | | repeatCycleTime | number | No | Repeat interval. |
| repeatCount | number | No | Number of repeat times. | | repeatCount | number | No | Number of repeat times. |
| isPersisted | boolean | No | Whether to enable persistent storage for the task. | | isPersisted | boolean | No | Whether to enable persistent storage for the task. |
| isDeepIdle | boolean | No | Whether the device needs to enter the idle state. | | isDeepIdle | boolean | No | Whether the device needs to enter the idle state. |
| idleWaitTime | number | No | Time to wait in the idle state. | | idleWaitTime | number | No | Time to wait in the idle state. |
## NetworkType ## NetworkType
Enumerates the network types that can trigger the task. Enumerates the network types that can trigger the task.
...@@ -336,8 +342,8 @@ Enumerates the storage states that can trigger the task. ...@@ -336,8 +342,8 @@ Enumerates the storage states that can trigger the task.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler **System capability**: SystemCapability.ResourceSchedule.WorkScheduler
|Name |Default Value |Description| | Name | Default Value | Description |
| -------- | -------- | -------- | | ------------------------- | ---- | ------------------------------ |
|STORAGE_LEVEL_LOW |0 |The storage space is insufficient. | STORAGE_LEVEL_LOW | 0 | The storage space is insufficient. |
|STORAGE_LEVEL_OKAY |1 |The storage space is restored from insufficient to normal. | STORAGE_LEVEL_OKAY | 1 | The storage space is restored from insufficient to normal. |
|STORAGE_LEVEL_LOW_OR_OKAY |2 |The storage space is restored from insufficient to normal, or the storage space is insufficient. | STORAGE_LEVEL_LOW_OR_OKAY | 2 | The storage space is restored from insufficient to normal, or the storage space is insufficient.|
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
The **\<Image>** component is used to render and display local and online images. The **\<Image>** component is used to render and display local and online images.
> **NOTE** > **NOTE**
>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
...@@ -35,33 +34,33 @@ Obtains an image from the specified source for subsequent rendering and display. ...@@ -35,33 +34,33 @@ Obtains an image from the specified source for subsequent rendering and display.
**Parameters** **Parameters**
| Name| Type | Mandatory| Default Value| Description | | Name | Type | Mandatory | Default Value | Description |
| ------ | ------------------------------------------------------------ | ---- | ------ | ------------------------------------------------------------ | | ---- | ---------------------------------------- | ---- | ---- | ---------------------------------------- |
| src | string \| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](../../ui/ts-types.md) | Yes | - | Image source. Both local and online images are supported.<br>When using resources referenced using a relative path, for example, `Image("common/test.jpg")`, the **\<Image>** component cannot be called across bundles or modules. Therefore, you are advised to use `$r` to reference image resources that need to be used globally.<br>\- The following image formats are supported: PNG, JPG, BMP, SVG, GIF.<br>\- Base64 strings are supported. The value format is `data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, where `[base64 data]` is a Base64 string.<br/>\- The value can also be a path starting with `dataability://`, which is used to access the image path provided by a Data ability. | | src | string\| [PixelMap](../apis/js-apis-image.md#pixelmap7)\| [Resource](../../ui/ts-types.md#resource-type) | Yes | - | Image source. Both local and online images are supported.<br>When using resources referenced using a relative path, for example, `Image("common/test.jpg")`, the **\<Image>** component cannot be called across bundles or modules. Therefore, you are advised to use `$r` to reference image resources that need to be used globally.<br>- The following image formats are supported: PNG, JPG, BMP, SVG, GIF.<br>\- Base64 strings are supported. \ The value format is `data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, where `[base64 data]` is a Base64 string.<br/>\- The value can also be a path starting with `dataability://`, which is used to access the image path provided by a Data ability.|
## Attributes ## Attributes
In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name | Type | Default Value | Description | | Name | Type | Default Value | Description |
| --------------------- | ---------------------------------------- | ------------------------ | ---------------------------------------- | | --------------------- | ------------------------------------------------------- | ------------------------ | ------------------------------------------------------------ |
| alt | string \| [Resource](../../ui/ts-types.md) | - | Placeholder image displayed during loading. Both local and Internet URIs are supported. | | alt | string \| [Resource](../../ui/ts-types.md#resource-type) | - | Placeholder image displayed during loading. Both local and Internet URIs are supported. |
| objectFit | [ImageFit](#imagefit-enums) | ImageFit.Cover | Image scale type. | | objectFit | ImageFit | ImageFit.Cover | Image scale type. |
| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | NoRepeat | Whether the image is repeated.<br>**NOTE**<br>This attribute is not applicable to SVG images. | | objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | NoRepeat | Whether the image is repeated.<br>**NOTE**<br>This attribute is not applicable to SVG images. |
| interpolation | [ImageInterpolation](#imageinterpolation) | ImageInterpolation.None | Interpolation effect of the image. This attribute is valid only when the image is zoomed in.<br>**NOTE**<br>This attribute is not applicable to SVG images or **PixelMap** objects. | | interpolation | [ImageInterpolation](#imageinterpolation) | ImageInterpolation.None | Interpolation effect of the image. This attribute is intended to alleviate aliasing that occurs when a low-definition image is zoomed in.<br>**NOTE**<br>> This attribute is not applicable to SVG images.<br>> This attribute is not applicable to **PixelMap** objects. |
| renderMode | [ImageRenderMode](#imagerendermode) | ImageRenderMode.Original | Rendering mode of the image.<br>**NOTE**<br>This attribute is not applicable to SVG images. | | renderMode | [ImageRenderMode](#imagerendermode) | ImageRenderMode.Original | Rendering mode of the image.<br>**NOTE**<br>This attribute is not applicable to SVG images. |
| sourceSize | {<br>width: number,<br>height: number<br>} | - | Decoding size of the image. The original image is decoded into an image of the specified size, in px.<br>**NOTE**<br>This attribute is not applicable to **PixelMap** objects. | | sourceSize | {<br>width: number,<br>height: number<br>} | - | Decoding size of the image. The original image is decoded into an image of the specified size, in px.<br>**NOTE**<br>This attribute is not applicable to **PixelMap** objects. |
| syncLoad<sup>8+</sup> | boolean | false | Whether to load images synchronously. By default, images are loaded asynchronously. During synchronous loading, the UI thread is blocked and the placeholder diagram is not displayed. | | syncLoad<sup>8+</sup> | boolean | false | Whether to load images synchronously. By default, images are loaded asynchronously. During synchronous loading, the UI thread is blocked and the placeholder diagram is not displayed. |
### ImageFit ### ImageFit
| Name | Description | | Name | Description |
| --------- | -------------------------------- | | --------- | ------------------------------------------------------------ |
| Cover | The image is scaled with its aspect ratio retained for both sides to be greater than or equal to the display boundaries. | | Cover | The image is scaled with its aspect ratio retained for both sides to be greater than or equal to the display boundaries.|
| Contain | The image is scaled with its aspect ratio retained for the content to be completely displayed within the display boundaries. | | Contain | The image is scaled with its aspect ratio retained for the content to be completely displayed within the display boundaries. |
| Fill | The image is scaled to fill the display area, and its aspect ratio is not retained. | | Fill | The image is scaled to fill the display area, and its aspect ratio is not retained. |
| None | The image is displayed in its original size. Generally, this enum is used together with the **objectRepeat** attribute.| | None | The image is displayed in its original size. |
| ScaleDown | The image is displayed with its aspect ratio retained, in a size smaller than or equal to the original size. | | ScaleDown | The image is displayed with its aspect ratio retained, in a size smaller than or equal to the original size. |
### ImageInterpolation ### ImageInterpolation
...@@ -79,6 +78,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -79,6 +78,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Original | The image is rendered based on the original image, including the color. | | Original | The image is rendered based on the original image, including the color. |
| Template | The image is rendered as a template image, and its color is ignored.| | Template | The image is rendered as a template image, and its color is ignored.|
## Events ## Events
In addition to the universal events (ts-universal-events-click.md), the following events are supported. In addition to the universal events (ts-universal-events-click.md), the following events are supported.
...@@ -159,7 +159,7 @@ struct ImageExample1 { ...@@ -159,7 +159,7 @@ struct ImageExample1 {
} }
``` ```
![en-us_image_0000001211898484](figures/en-us_image_0000001211898484.gif) ![zh-cn_image_0000001250492613](figures/zh-cn_image_0000001250492613.gif)
### Setting Attributes ### Setting Attributes
...@@ -227,7 +227,7 @@ struct ImageExample2 { ...@@ -227,7 +227,7 @@ struct ImageExample2 {
} }
``` ```
![en-us_image_0000001212058474](figures/en-us_image_0000001212058474.png) ![zh-cn_image_0000001205812616](figures/zh-cn_image_0000001205812616.png)
### Invoking Events ### Invoking Events
...@@ -235,8 +235,8 @@ struct ImageExample2 { ...@@ -235,8 +235,8 @@ struct ImageExample2 {
@Entry @Entry
@Component @Component
struct ImageExample3 { struct ImageExample3 {
@State width: number = 0 @State widthValue: number = 0
@State height: number = 0 @State heightValue: number = 0
private on: Resource = $r('app.media.image_on') private on: Resource = $r('app.media.image_on')
private off: Resource = $r('app.media.image_off') private off: Resource = $r('app.media.image_off')
private on2off: Resource = $r('app.media.image_on2off') private on2off: Resource = $r('app.media.image_on2off')
...@@ -257,8 +257,8 @@ struct ImageExample3 { ...@@ -257,8 +257,8 @@ struct ImageExample3 {
.height(180).width(180) .height(180).width(180)
// Obtain the size of an image after the image loading is complete. // Obtain the size of an image after the image loading is complete.
.onComplete((msg: { width: number,height: number }) => { .onComplete((msg: { width: number,height: number }) => {
this.width = msg.width this.widthValue = msg.width
this.height = msg.height this.heightValue = msg.height
}) })
.onError(() => { .onError(() => {
console.log('load image fail') console.log('load image fail')
...@@ -291,4 +291,4 @@ struct ImageExample3 { ...@@ -291,4 +291,4 @@ struct ImageExample3 {
} }
``` ```
![en-us_image_0000001256858397](figures/en-us_image_0000001256858397.gif) ![zh-cn_image_0000001205972610](figures/zh-cn_image_0000001205972610.gif)
# Text # Text
> **NOTE**<br/>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **\<Text>** component is used to display a piece of textual information. The **\<Text>** component is used to display a piece of textual information.
> **NOTE**
>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Required Permissions ## Required Permissions
N/A None
## Child Components ## Child Components
...@@ -32,8 +32,8 @@ Text(content?: string) ...@@ -32,8 +32,8 @@ Text(content?: string)
| Name| Type| Default Value| Description| | Name| Type| Default Value| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| textAlign | TextAlign | TextAlign.Start | Text alignment mode of multiple lines of text.| | textAlign | TextAlign | TextAlign.Start | Text alignment mode of multiple lines of text.|
| textOverflow | {overflow: TextOverflow} | {overflow: TextOverflow.Clip} | Display mode when the text is too long.<br>**NOTE**<br>Text is truncated at the transition between words. To truncate text in the middle of a word, add **\u200B** between characters. | | textOverflow | {overflow: TextOverflow} | {overflow: TextOverflow.Clip} | Display mode when the text is too long.<br>**NOTE**<br/><br>Text is truncated at the transition between words. To truncate text in the middle of a word, add **\u200B** between characters.<br>This attribute must be used with `maxLines` to take effect.|
| maxLines | number | Infinity | Maximum number of lines in the text.| | maxLines | number | Infinity | Maximum number of lines in the text.<br>**NOTE**<br/><br>By default, text is automatically folded. If this parameter is specified, the text does not exceed the specified number of lines. If there is extra text, you can use `textOverflow` to specify the truncation mode.|
| lineHeight | Length | - | Text line height. If the value is less than or equal to **0**, the line height is not limited and the font size is adaptive. If the value of the number type, the unit fp is used.| | lineHeight | Length | - | Text line height. If the value is less than or equal to **0**, the line height is not limited and the font size is adaptive. If the value of the number type, the unit fp is used.|
| decoration | {<br>type: TextDecorationType,<br>color?: Color<br>} | {<br>type: TextDecorationType.None,<br>color: Color.Black<br>} | Style and color of the text decorative line.| | decoration | {<br>type: TextDecorationType,<br>color?: Color<br>} | {<br>type: TextDecorationType.None,<br>color: Color.Black<br>} | Style and color of the text decorative line.|
| baselineOffset | Length | - | Offset of the text baseline.| | baselineOffset | Length | - | Offset of the text baseline.|
...@@ -78,7 +78,8 @@ Text(content?: string) ...@@ -78,7 +78,8 @@ Text(content?: string)
| LocalDevice | Intra-device copy and paste is allowed.| | LocalDevice | Intra-device copy and paste is allowed.|
| CrossDevice | Cross-device copy and paste is allowed.| | CrossDevice | Cross-device copy and paste is allowed.|
> **NOTE**<br/> > **NOTE**
>
> If the **\<Text>** component contains both the text and the **\<Span>** child component, only the content in **\<Span>** is displayed. > If the **\<Text>** component contains both the text and the **\<Span>** child component, only the content in **\<Span>** is displayed.
......
...@@ -34,8 +34,8 @@ Not supported ...@@ -34,8 +34,8 @@ Not supported
| Name | Type | Default Value | Description | | Name | Type | Default Value | Description |
| ------------------ | ---------------------------------------- | ----------------- | ---------------------------------------- | | ------------------ | ---------------------------------------- | ----------------- | ---------------------------------------- |
| domStorageAccess | boolean | false | Whether to enable the DOM Storage API permission. By default, the permission is disabled.| | domStorageAccess | boolean | false | Whether to enable the DOM Storage API permission. By default, the permission is disabled.|
| fileAccess | boolean | false | Whether to enable in-application rawfile access through [$rawfile(filepath/filename)](../../ui/ts-application-resource-access.md). By default, this feature is enabled. | | fileAccess | boolean | false | Whether to enable in-application rawfile access through [$rawfile(filepath/filename)](../../ui/ts-resource-access.md). By default, this feature is enabled. |
| fileFromUrlAccess | boolean | true | Whether to allow JavaScript scripts on web pages to access the content in [$rawfile(filepath/filename)](../../ui/ts-application-resource-access.md). By default, this feature is disabled. | | fileFromUrlAccess | boolean | true | Whether to allow JavaScript scripts on web pages to access the content in [$rawfile(filepath/filename)](../../ui/ts-resource-access.md). By default, this feature is disabled. |
| imageAccess | boolean | true | Whether to enable automatic image loading. By default, this feature is enabled. | | imageAccess | boolean | true | Whether to enable automatic image loading. By default, this feature is enabled. |
| javaScriptProxy | { <br> object: object, <br> name: string, <br> methodList: Array\<string\>, <br> controller: WebController <br>} | - | JavaScript object to be injected into the window. Methods of this object can be invoked in the window. The parameters in this attribute cannot be updated.<br> **object** indicates the object to be registered. Methods can be declared, but not attributes. The parameters and return value can only be of the string, number, or Boolean type.<br> **name** indicates the name of the object to be registered, which is the same as that invoked in the window. After registration, the window can use this name to access the JavaScript object at the application side.<br> **methodList** indicates the methods of the JavaScript object to be registered at the application side.<br> **controller** indicates the controller.| | javaScriptProxy | { <br> object: object, <br> name: string, <br> methodList: Array\<string\>, <br> controller: WebController <br>} | - | JavaScript object to be injected into the window. Methods of this object can be invoked in the window. The parameters in this attribute cannot be updated.<br> **object** indicates the object to be registered. Methods can be declared, but not attributes. The parameters and return value can only be of the string, number, or Boolean type.<br> **name** indicates the name of the object to be registered, which is the same as that invoked in the window. After registration, the window can use this name to access the JavaScript object at the application side.<br> **methodList** indicates the methods of the JavaScript object to be registered at the application side.<br> **controller** indicates the controller.|
| javaScriptAccess | boolean | true | Whether JavaScript scripts can be executed. By default, JavaScript scripts can be executed. | | javaScriptAccess | boolean | true | Whether JavaScript scripts can be executed. By default, JavaScript scripts can be executed. |
......
# CanvasRenderingContext2D # CanvasRenderingContext2D
> **NOTE**<br>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
The **\<RenderingContext>** component is used to draw rectangles, text, images, and other objects on a canvas. The **\<RenderingContext>** component is used to draw rectangles, text, images, and other objects on a canvas.
> **NOTE**
>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
## APIs ## APIs
...@@ -20,14 +19,14 @@ CanvasRenderingContext2D(setting: RenderingContextSetting) ...@@ -20,14 +19,14 @@ CanvasRenderingContext2D(setting: RenderingContextSetting)
### RenderingContextSettings ### RenderingContextSettings
RenderingContextSettings(antialias?: bool) RenderingContextSettings(antialias?: boolean)
Configures the settings of a **CanvasRenderingContext2D** object, including whether to enable antialiasing. Configures the settings of a **CanvasRenderingContext2D** object, including whether to enable antialiasing.
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name | Type | Mandatory | Default Value | Description |
| --------- | ---- | --------- | ------------- | -------------------------------- | | --------- | ---- | --------- | ------------- | -------------------------------- |
| antialias | bool | No | false | Whether antialiasing is enabled. | | antialias | boolean | No | false | Whether antialiasing is enabled. |
## Attributes ## Attributes
...@@ -259,7 +258,7 @@ struct MiterLimit { ...@@ -259,7 +258,7 @@ struct MiterLimit {
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct Font { struct Fonts {
private settings: RenderingContextSettings = new RenderingContextSettings(true) private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
...@@ -1282,7 +1281,8 @@ Draws an arc on the canvas. ...@@ -1282,7 +1281,8 @@ Draws an arc on the canvas.
- Example - Example
``` ```ts
// xxx.ets
@Entry @Entry
@Component @Component
struct Arc { struct Arc {
...@@ -1854,7 +1854,7 @@ Obtains the **[PixelMap](../apis/js-apis-image.md#pixelmap7)** object created wi ...@@ -1854,7 +1854,7 @@ Obtains the **[PixelMap](../apis/js-apis-image.md#pixelmap7)** object created wi
getImageData(sx: number, sy: number, sw: number, sh: number): Object getImageData(sx: number, sy: number, sw: number, sh: number): Object
Creates an **[ImageData](ts-components-canvas-imagebitmap.md)** object with pixels in the specified area on the canvas. Obtains the **[ImageData](ts-components-canvas-imagebitmap.md)** object created with the pixels within the specified area on the canvas.
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name | Type | Mandatory | Default Value | Description |
| ---- | ------ | --------- | ------------- | ---------------------------------------- | | ---- | ------ | --------- | ------------- | ---------------------------------------- |
......
# Combined Gestures # Combined Gestures
Continuous recognition, parallel recognition, and exclusive recognition are supported for a group of gestures.
> **NOTE**<br> > **NOTE**
>
> Combined gestures are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > Combined gestures are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
...@@ -21,37 +23,38 @@ GestureGroup(mode: GestureMode, ...gesture: GestureType[]) ...@@ -21,37 +23,38 @@ GestureGroup(mode: GestureMode, ...gesture: GestureType[])
| gesture | [TapGesture](ts-basic-gestures-tapgesture.md)<br/>\| [LongPressGesture](ts-basic-gestures-longpressgesture.md)<br/>\| [PanGesture](ts-basic-gestures-pangesture.md)<br/>\| [PinchGesture](ts-basic-gestures-pinchgesture.md)<br/>\| [RotationGesture](ts-basic-gestures-rotationgesture.md) | Yes | - | Variable-length parameter, indicating one or more basic gesture types. These gestures are recognized in combination. | | gesture | [TapGesture](ts-basic-gestures-tapgesture.md)<br/>\| [LongPressGesture](ts-basic-gestures-longpressgesture.md)<br/>\| [PanGesture](ts-basic-gestures-pangesture.md)<br/>\| [PinchGesture](ts-basic-gestures-pinchgesture.md)<br/>\| [RotationGesture](ts-basic-gestures-rotationgesture.md) | Yes | - | Variable-length parameter, indicating one or more basic gesture types. These gestures are recognized in combination. |
- GestureMode enums - GestureMode enums
| Name | Description | | Name | Description |
| -------- | -------- | | -------- | -------- |
| Sequence | Sequential recognition: Gestures are recognized in the registration sequence until all gestures are recognized successfully. When one gesture fails to be recognized, all gestures fail to be recognized. | | Sequence | Sequential recognition: Gestures are recognized in the registration sequence until all gestures are recognized successfully. When one gesture fails to be recognized, all gestures fail to be recognized. |
| Parallel | Parallel recognition. Registered gestures are recognized concurrently until all gestures are recognized. The recognition result of each gesture does not affect each other. | | Parallel | Parallel recognition. Registered gestures are recognized concurrently until all gestures are recognized. The recognition result of each gesture does not affect each other. |
| Exclusive | Exclusive recognition. Registered gestures are identified concurrently. If one gesture is successfully recognized, gesture recognition ends. | | Exclusive | Exclusive recognition. Registered gestures are identified concurrently. If one gesture is successfully recognized, gesture recognition ends. |
## Events ## Events
| Name | Description | | Name | Description |
| -------- | -------- | | -------- | -------- |
| onCancel(event: () =&gt; void) | Callback for the GestureMode.Sequence cancellation event. | | onCancel(event: () =&gt; void) | Callback for the GestureMode.Sequence cancellation event. |
## Example ## Example
``` ```ts
// xxx.ets
@Entry @Entry
@Component @Component
struct GestureGroupExample { struct GestureGroupExample {
@State count: number = 0 @State count: number = 0
@State offsetX: number = 0 @State offsetX: number = 0
@State offsetY: number = 0 @State offsetY: number = 0
@State borderStyle: BorderStyle = BorderStyle.Solid @State borderStyles: BorderStyle = BorderStyle.Solid
build() { build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('sequence gesture\n' + 'LongPress onAction:' + this.count + '\nPanGesture offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + this.offsetY) Text('sequence gesture\n' + 'LongPress onAction:' + this.count + '\nPanGesture offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + this.offsetY)
}.translate({ x: this.offsetX, y: this.offsetY, z: 5 }) }.translate({ x: this.offsetX, y: this.offsetY, z: 5 })
.height(100).width(200).padding(10).margin(80).border({ width: 1, style: this.borderStyle }) .height(100).width(200).padding(10).margin(80).border({ width: 1, style: this.borderStyles })
.gesture( .gesture(
GestureGroup(GestureMode.Sequence, GestureGroup(GestureMode.Sequence,
LongPressGesture({ repeat: true }) LongPressGesture({ repeat: true })
...@@ -64,7 +67,7 @@ struct GestureGroupExample { ...@@ -64,7 +67,7 @@ struct GestureGroupExample {
}), }),
PanGesture({}) PanGesture({})
.onActionStart(() => { .onActionStart(() => {
this.borderStyle = BorderStyle.Dashed this.borderStyles = BorderStyle.Dashed
console.log('pan start') console.log('pan start')
}) })
.onActionUpdate((event: GestureEvent) => { .onActionUpdate((event: GestureEvent) => {
......
# AbilityComponent # AbilityComponent
**\<AbilityComponent>** is a container for independently displaying an ability.
> **NOTE** > **NOTE**
> >
> This component is supported since API version 9. > This component is supported since API version 9.
...@@ -7,8 +9,6 @@ ...@@ -7,8 +9,6 @@
> The APIs of this module are system APIs and cannot be called by third-party applications. > The APIs of this module are system APIs and cannot be called by third-party applications.
**\<AbilityComponent>** is a container for independently displaying an ability.
## Constraints ## Constraints
Using **\<AbilityComponent>** requires a signature and related permissions. Using **\<AbilityComponent>** requires a signature and related permissions.
...@@ -41,34 +41,20 @@ Not supported ...@@ -41,34 +41,20 @@ Not supported
## APIs ## APIs
AbilityComponent(value: {want : Want, controller? : AbilityController}) AbilityComponent(value: {want : Want})
- Parameters - Parameters
| Name| Type| Mandatory| Default Value| Description| | Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| want | [Want](../../reference/apis/js-apis-application-Want.md) | Yes| - | Description of the default ability to load.| | want | [Want](../../reference/apis/js-apis-application-Want.md) | Yes| - | Description of the default ability to load.|
| controller | [AbilityController](#abilityController) | No| - | Ability controller.|
## Events ## Events
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| onReady()&nbsp;=&gt;&nbsp;void | Called when this **\<AbilityComponent>** is started. You can then use APIs in the **\<AbilityComponent>**.| | onConnect()&nbsp;=&gt;&nbsp;void | Called when this **\<AbilityComponent>** is started. You can then use APIs in the **\<AbilityComponent>**.|
| onDestroy()&nbsp;=&gt;&nbsp;void | Called when this **\<AbilityComponent>** is destroyed.| | onDisconnect()&nbsp;=&gt;&nbsp;void | Called when this **\<AbilityComponent>** is destroyed.|
| onAbilityCreated(name:&nbsp;string)&nbsp;=&gt;&nbsp;void | Called when the specified ability is loaded.|
| onAbilityMoveToFont()&nbsp;=&gt;&nbsp;void | Called when this ability is moved to the foreground.|
| onAbilityWillRemove()&nbsp;=&gt;&nbsp;void | Called when this ability is about to be removed.|
## AbilityController
Implements an ability controller, which provides the control APIs for **\<AbilityComponent>**.
| Name | Description |
| --------------------------------------- | ------------------------------------------------------------ |
| startAbility()&nbsp;=&gt;&nbsp;want | Loads an ability inside the **\<AbilityComponent>**.<br>**want**: description of the ability to be loaded.|
| preformBackPress()&nbsp;=&gt;&nbsp;void | Performs a return operation inside the **\<AbilityComponent>**. |
| getStackCount()&nbsp;=&gt;&nbsp;void | Obtains the number of tasks in the internal task stack of the **\<AbilityComponent>**. |
## Example ## Example
...@@ -78,7 +64,6 @@ Implements an ability controller, which provides the control APIs for **\<Abilit ...@@ -78,7 +64,6 @@ Implements an ability controller, which provides the control APIs for **\<Abilit
@Entry @Entry
@Component @Component
struct MyComponent { struct MyComponent {
@State controller: AbilityController = new AbilityController()
build() { build() {
Column() { Column() {
...@@ -87,26 +72,12 @@ struct MyComponent { ...@@ -87,26 +72,12 @@ struct MyComponent {
bundleName: '', bundleName: '',
abilityName: '' abilityName: ''
}, },
controller: this.controller
})
.onReady(() => {
console.log('AbilityComponent ready');
})
.onDestory(() => {
console.log('AbilityComponent destory');
}) })
Button("Start New") .onConnect(() => {
.onClick(() => { console.log('AbilityComponent connect');
this.controller.startAbility({
bundleName: '',
abilityName: ''
});
}) })
Button("Back") .onDisconnect(() => {
.onClick(() => { console.log('AbilityComponent disconnect');
if (this.controller.getStacjCount() > 1) {
this.controller.preformBackPress();
}
}) })
} }
} }
......
# Column # Column
> **NOTE**<br> The **\<Column>** component lays out child components vertically.
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **&lt;Column&gt;** component lays out child components vertically. > **NOTE**
>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Required Permissions ## Required Permissions
...@@ -47,7 +47,8 @@ Column(value:{space?: Length}) ...@@ -47,7 +47,8 @@ Column(value:{space?: Length})
## Example ## Example
``` ```ts
// xxx.ets
@Entry @Entry
@Component @Component
struct ColumnExample { struct ColumnExample {
...@@ -76,6 +77,7 @@ struct ColumnExample { ...@@ -76,6 +77,7 @@ struct ColumnExample {
Column().width('30%').height(30).backgroundColor(0xAFEEEE) Column().width('30%').height(30).backgroundColor(0xAFEEEE)
Column().width('30%').height(30).backgroundColor(0x00FFFF) Column().width('30%').height(30).backgroundColor(0x00FFFF)
}.height('15%').border({ width: 1 }).justifyContent(FlexAlign.Center) }.height('15%').border({ width: 1 }).justifyContent(FlexAlign.Center)
Text('justifyContent(End)').fontSize(9).fontColor(0xCCCCCC).width('90%') Text('justifyContent(End)').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column() { Column() {
Column().width('30%').height(30).backgroundColor(0xAFEEEE) Column().width('30%').height(30).backgroundColor(0xAFEEEE)
......
# Flex # Flex
> **NOTE**<br/>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **\<Flex>** component allows for elastic layout of child components. The **\<Flex>** component allows for elastic layout of child components.
> **NOTE**
> - This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
> - The **\<Flex>** component adapts the layout of flex items to comply with the **flexShrink** and **flexGrow** settings. This may affect the performance. Therefore, you are advised to use **[Column](ts-container-column.md)** or **[Row](ts-container-row.md)** instead under scenarios where consistently high performance is required.
## Required Permissions ## Required Permissions
...@@ -25,44 +24,44 @@ Flex(options?: { direction?: FlexDirection, wrap?: FlexWrap, justifyContent?: F ...@@ -25,44 +24,44 @@ Flex(options?: { direction?: FlexDirection, wrap?: FlexWrap, justifyContent?: F
Creates a standard **\<Flex>** component. Creates a standard **\<Flex>** component.
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------------- | ---------------------------------------- | ---- | ----------------- | ---------------------------------------- |
| direction | FlexDirection | No | FlexDirection.Row | Direction in which child components are arranged in the **\<Flex>** component, that is, the direction of the main axis. | | direction | FlexDirection | No | FlexDirection.Row | Direction in which child components are arranged in the **\<Flex>** component, that is, the direction of the main axis. |
| wrap | FlexWrap | No | FlexWrap.NoWrap | Whether the **\<Flex>** component has a single line or multiple lines. | | wrap | FlexWrap | No | FlexWrap.NoWrap | Whether the **\<Flex>** component has a single line or multiple lines. |
| justifyContent | FlexAlign | No | FlexAlign.Start | Alignment mode of the child components in the **\<Flex>** component along the main axis. | | justifyContent | FlexAlign | No | FlexAlign.Start | Alignment mode of the child components in the **\<Flex>** component along the main axis. |
| alignItems | [ItemAlign](ts-appendix-enums.md#itemalign-enums) | No | ItemAlign.Stretch | Alignment mode of the child components in the **\<Flex>** component along the cross axis. | | alignItems | [ItemAlign](ts-appendix-enums.md#itemalign-enums)| No | ItemAlign.Stretch | Alignment mode of the child components in the **\<Flex>** component along the cross axis. |
| alignContent | FlexAlign | No | FlexAlign.Start | Alignment mode of the child components in a multi-line **\<Flex>** component along the cross axis. This parameter is valid only when **wrap** is set to **Wrap** or **WrapReverse**. | | alignContent | FlexAlign | No | FlexAlign.Start | Alignment mode of the child components in a multi-line **<Flex>** component along the cross axis. This parameter is valid only when **wrap** is set to **Wrap** or **WrapReverse**.|
- FlexDirection enums - FlexDirection enums
| Name | Description | | Name | Description |
| -------- | -------- | | ------------- | ---------------- |
| Row | The child components are arranged in the same direction as the main axis runs along the rows. | | Row | The child components are arranged in the same direction as the main axis runs along the rows. |
| RowReverse | The child components are arranged opposite to the **Row** direction. | | RowReverse | The child components are arranged opposite to the **Row** direction. |
| Column | The child components are arranged in the same direction as the main axis runs down the columns. | | Column | The child components are arranged in the same direction as the main axis runs down the columns. |
| ColumnReverse | The child components are arranged opposite to the **Column** direction. | | ColumnReverse | The child components are arranged opposite to the **Column** direction.|
- FlexWrap enums - FlexWrap enums
| Name | Description | | Name | Description |
| -------- | -------- | | ----------- | ------------------------------------------------- |
| NoWrap | The child components in the **&lt;Flex&gt;** component are arranged in a single line, and they may overflow. | | NoWrap | The child components in the **\<Flex>** component are arranged in a single line, and they cannot overflow. |
| Wrap | The child components in the **&lt;Flex&gt;** component are arranged in multiple lines, and they may overflow. | | Wrap | The child components in the **\<Flex>** component are arranged in multiple lines, and they may overflow. |
| WrapReverse | The child components in the **&lt;Flex&gt;** component are reversely arranged in multiple lines, and they may overflow. | | WrapReverse | The child components in the **\<Flex>** component are reversely arranged in multiple lines, and they may overflow.|
- FlexAlign enums - FlexAlign enums
| Name | Description | | Name | Description |
| -------- | -------- | | ------------ | ------------------------------------------------------------ |
| Start | The child components are aligned with the start edge of the main axis. The first component is aligned with the main-start, and subsequent components are aligned with the previous one. | | Start | The child components are aligned with the start edge of the main axis. The first component is aligned with the main-start, and subsequent components are aligned with the previous one.|
| Center | The child components are aligned in the center of the main axis. The space between the first component and the main-start is the same as that between the last component and the main-end. | | Center | The child components are aligned in the center of the main axis. The space between the first component and the main-start is the same as that between the last component and the main-end.|
| End | The child components are aligned with the end edge of the main axis. The last component is aligned with the main-end, and other components are aligned with the next one. | | End | The child components are aligned with the end edge of the main axis. The last component is aligned with the main-end, and other components are aligned with the next one.|
| SpaceBetween | The child components are evenly distributed along the main axis. The first component is aligned with the main-start, the last component is aligned with the main-end, and the remaining components are distributed so that the space between any two adjacent components is the same. | | SpaceBetween | The child components are evenly distributed along the main axis. The space between any two adjacent components is the same. The first component is aligned with the main-start, the last component is aligned with the main-end, and the remaining components are distributed so that the space between any two adjacent components is the same. |
| SpaceAround | The child components are evenly distributed along the main axis, with a half-size space on either end. The space between any two adjacent components is the same. The space between the first component and main-start, and that between the last component and cross-main are both half the size of the space between two adjacent components. | | SpaceAround | The child components are evenly distributed along the main axis. The space between any two adjacent components is the same. The space between the first component and main-start, and that between the last component and cross-main are both half the size of the space between two adjacent components. |
| SpaceEvenly | The child components are equally distributed along the main axis. The space between the first component and main-start, the space between the last component and main-end, and the space between two adjacent components are the same. | | SpaceEvenly | The child components are equally distributed along the main axis. The space between the first component and main-start, the space between the last component and main-end, and the space between two adjacent components are the same.|
## Example ## Example
``` ```ts
// Example 01 // xxx.ets
@Entry @Entry
@Component @Component
struct FlexExample1 { struct FlexExample1 {
...@@ -124,9 +123,8 @@ struct FlexExample1 { ...@@ -124,9 +123,8 @@ struct FlexExample1 {
![en-us_image_0000001256978365](figures/en-us_image_0000001256978365.gif) ![en-us_image_0000001256978365](figures/en-us_image_0000001256978365.gif)
```ts
``` // xxx.ets
// Example 02
@Entry @Entry
@Component @Component
struct FlexExample2 { struct FlexExample2 {
...@@ -171,9 +169,8 @@ struct FlexExample2 { ...@@ -171,9 +169,8 @@ struct FlexExample2 {
![en-us_image_0000001211898500](figures/en-us_image_0000001211898500.png) ![en-us_image_0000001211898500](figures/en-us_image_0000001211898500.png)
```ts
``` // xxx.ets
// Example 03
@Component @Component
struct JustifyContentFlex { struct JustifyContentFlex {
@Prop justifyContent : number @Prop justifyContent : number
...@@ -221,9 +218,8 @@ struct FlexExample3 { ...@@ -221,9 +218,8 @@ struct FlexExample3 {
![en-us_image_0000001212218462](figures/en-us_image_0000001212218462.gif) ![en-us_image_0000001212218462](figures/en-us_image_0000001212218462.gif)
```ts
``` // xxx.ets
// Example 04
@Component @Component
struct AlignItemsFlex { struct AlignItemsFlex {
@Prop alignItems : number @Prop alignItems : number
...@@ -273,9 +269,8 @@ struct FlexExample4 { ...@@ -273,9 +269,8 @@ struct FlexExample4 {
![en-us_image_0000001212378426](figures/en-us_image_0000001212378426.gif) ![en-us_image_0000001212378426](figures/en-us_image_0000001212378426.gif)
```ts
``` // xxx.ets
// Example 05
@Component @Component
struct AlignContentFlex { struct AlignContentFlex {
@Prop alignContent: number @Prop alignContent: number
......
# Swiper # Swiper
> **NOTE**<br> The **\<Swiper>** component provides a container that allows users to switch among child components using swipe gestures.
> **NOTE**
> >
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **<Swiper\>** component provides a container that allows users to switch among child components through swiping.
## Required Permissions ## Required Permissions
None None
...@@ -23,49 +22,94 @@ This component can contain child components. ...@@ -23,49 +22,94 @@ This component can contain child components.
Swiper(value:{controller?: SwiperController}) Swiper(value:{controller?: SwiperController})
- Parameters **Parameters**
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| controller | [SwiperController](#swipercontroller) | No | null | Controller bound to the component to control the page switching. |
| Name | Type | Mandatory | Description |
| ---------- | ------------------------------------- | ---- | -------------------- |
| controller | [SwiperController](#swipercontroller) | No | Controller bound to the component to control the page switching.<br>Default value: **null** |
## Attributes
| Name | Type | Default Value | Description | ## Attributes
| -------- | -------- | -------- | -------- |
| index | number | 0 | Index of the child component currently displayed in the container. |
| autoPlay | boolean | false | Whether to enable automatic playback for child component switching. If this attribute is **true**, the indicator dots do not take effect. |
| interval | number | 3000 | Interval for automatic playback, in ms. |
| indicator | boolean | true | Whether to enable the navigation dots. |
| loop | boolean | true | Whether to enable loop playback.<br>The value **true** means to enable loop playback. When **LazyForEach** is used, it is recommended that the number of the components to load exceed 5. |
| duration | number | 400 | Duration of the animation for switching child components, in ms. |
| vertical | boolean | false | Whether vertical swiping is used. |
| itemSpace | Length | 0 | Space between child components. |
| cachedCount<sup>8+</sup> | number | 1 | Number of child components to be cached. |
| disableSwipe<sup>8+</sup> | boolean | false | Whether to disable the swipe feature. |
| curve<sup>8+</sup> | [Curve](ts-animatorproperty.md) \| Curves | Curve.Ease | Animation curve. The ease-in/ease-out curve is used by default. For details about common curves, see [Curve enums](ts-animatorproperty.md). You can also create custom curves ([interpolation curve objects](ts-interpolation-calculation.md)) by using APIs provided by the interpolation calculation module. |
| indicatorStyle<sup>8+</sup> | {<br/>left?:&nbsp;Length,<br/>top?:&nbsp;Length,<br/>right?:&nbsp;Length,<br/>bottom?:&nbsp;Length,<br/>size?:&nbsp;Length,<br/>color?:&nbsp;Color,<br/>selectedColor?:&nbsp;Color<br/>} | - | Style of the navigation dots indicator.<br/>- **left**:&nbsp;distance between the navigation dots indicator and the left edge of the **\<Swiper>** component.<br/>- **top**:&nbsp;distance between the navigation dots indicator and the top edge of the **\<Swiper>** component.<br/>- **right**:&nbsp;distance between the navigation dots indicator and the right edge of the **\<Swiper>** component.<br/>- **bottom**:&nbsp;distance between the navigation dots indicator and the right edge of the **\<Swiper>** component.<br/>- **size**:&nbsp;diameter of the navigation dots indicator.<br/>- **color**:&nbsp;color of the navigation dots indicator.<br/>- **selectedColor**:&nbsp;color of the selected navigation dot. |
[Menu control](ts-universal-attributes-menu.md) is not supported.
| Name | Type | Description |
| --------------------------- | ---------------------------------------- | ---------------------------------------- |
| index | number | Index of the child component currently displayed in the container.<br>Default value: **0** |
| autoPlay | boolean | Whether to enable automatic playback for child component switching. If this attribute is **true**, the navigation dots indicator does not take effect.<br>Default value: **false** |
| interval | number | Interval for automatic playback, in ms.<br>Default value: **3000** |
| indicator | boolean | Whether to enable the navigation dots indicator.<br>Default value: **true** |
| loop | boolean | Whether to enable loop playback.<br>The value **true** means to enable loop playback. When LazyForEach is used, it is recommended that the number of the components to load exceed 5.<br>Default value: **true**|
| duration | number | Duration of the animation for switching child components, in ms.<br>Default value: **400** |
| vertical | boolean | Whether vertical swiping is used.<br>Default value: **false** |
| itemSpace | Length | Space between child components.<br>Default value: **0** |
| displayMode | SwiperDisplayMode | Mode in which elements are displayed along the main axis. This attribute takes effect only when **displayCount** is not set.<br>Default value: **SwiperDisplayMode.Stretch**|
| cachedCount<sup>8+</sup> | number | Number of child components to be cached.<br>Default value: **1** |
| disableSwipe<sup>8+</sup> | boolean | Whether to disable the swipe feature.<br>Default value: **false** |
| curve<sup>8+</sup> | [Curve](ts-animatorproperty.md#Curve) \| string | Animation curve. The ease-in/ease-out curve is used by default. For details about common curves, see [Curve enums](ts-animatorproperty.md#curve-enums). You can also create custom curves ([interpolation curve objects](ts-interpolation-calculation.md)) by using the API provided by the interpolation calculation module.<br>Default value: **Curve.Ease**|
| indicatorStyle<sup>8+</sup> | {<br>left?:&nbsp;Length,<br>top?:&nbsp;Length,<br>right?:&nbsp;Length,<br>bottom?:&nbsp;Length,<br>size?:&nbsp;Length,<br>color?:&nbsp;Color,<br>selectedColor?:&nbsp;Color<br>} | Style of the navigation dots indicator.<br>- **left**: distance between the navigation dots indicator and the left edge of the **\<Swiper>** component.<br>- **top**: distance between the navigation dots indicator and the top edge of the **\<Swiper>** component.<br>- **right**: distance between the navigation dots indicator and the right edge of the **\<Swiper>** component.<br>- **bottom**: distance between the navigation dots indicator and the bottom edge of the **\<Swiper>** component.<br>- **size**: diameter of the navigation dots indicator.<br>- **color**: color of the navigation dots indicator.<br>- **selectedColor**: color of the selected navigation dot.|
| displayCount<sup>8+</sup> | number\|string | Number of elements to display.<br>Default value: **1** |
| effectMode<sup>8+</sup> | EdgeEffect | Swipe effect. For details, see **EdgeEffect**.<br>Default value: **EdgeEffect.Spring**|
## SwiperDisplayMode
| Name| Description|
| ----------- | ------------------------------------------ |
| Stretch | The slide width of the **\<Swiper>** component is equal to the width of the component.|
| AutoLinear | The slide width of the **\<Swiper>** component is equal to the maximum width of the child components.|
## EdgeEffect
| Name | Description |
| ------ | ------------------------------------------------------------------------- |
| Spring | Spring effect. When at one of the edges, the component can move beyond the bounds through touches, and produce a bounce effect when the user releases their finger. |
| Fade | Fade effect. When at one of the edges, the component can move beyond the bounds through touches, and produce a fade effect along the way; when the user releases their finger, the fade changes. |
| None | No effect. When at one of the edges, the component cannot move beyond the bounds. |
## SwiperController ## SwiperController
Controller of the **<Swiper\>** component. You can bind this object to the **<Swiper\>** component and use it to control page switching. Controller of the **\<Swiper>** component. You can bind this object to the **<Swiper>** component and use it to control page switching.
### showNext
showNext(): void
Turns to the next page.
### showPrevious
showPrevious(): void
| Name | Description | Turns to the previous page.
| -------- | -------- |
| showNext():void | Turns to the next page. |
| showPrevious():void | Turns to the previous page. |
### finishAnimation
finishAnimation(callback?: () => void): void
Stops this animation.
**Parameters**
| Name | Type | Mandatory.| Description|
| --------- | ---------- | ------ | -------- |
| callback | () => void | Yes | Callback invoked when the animation stops.|
## Events ## Events
| Name | Description | ### onChange
| -------- | -------- |
| onChange( index: number) =&gt; void | Triggered when the index of the currently displayed component changes. |
onChange(&nbsp;index:&nbsp;number)&nbsp;=&gt;&nbsp;void
## Example Triggered when the index of the currently displayed component changes.
**Parameters**
| Name | Type | Mandatory.| Description|
| --------- | ---------- | ------ | -------- |
| index | number | Yes | Index of the currently displayed element.|
## Example
```ts ```ts
// xxx.ets // xxx.ets
...@@ -123,7 +167,7 @@ struct SwiperExample { ...@@ -123,7 +167,7 @@ struct SwiperExample {
.duration(1000) .duration(1000)
.vertical(false) // Horizontal swiping is enabled by default. .vertical(false) // Horizontal swiping is enabled by default.
.itemSpace(0) .itemSpace(0)
.curve(Curve.Linear) // Animation curve .curve(Curve.Linear) // Animation curve.
.onChange((index: number) => { .onChange((index: number) => {
console.info(index.toString()) console.info(index.toString())
}) })
......
# Tabs # Tabs
> **NOTE**<br>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **<Tabs\>** component is a container component that allows users to switch between content views through tabs. Each tab page corresponds to a content view. The **<Tabs\>** component is a container component that allows users to switch between content views through tabs. Each tab page corresponds to a content view.
> **NOTE**
>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Required Permissions ## Required Permissions
...@@ -87,7 +87,8 @@ Switches to the specified tab. ...@@ -87,7 +87,8 @@ Switches to the specified tab.
## Example ## Example
``` ```ts
// xxx.ets
@Entry @Entry
@Component @Component
struct TabsExample { struct TabsExample {
......
...@@ -273,7 +273,7 @@ struct MiterLimit { ...@@ -273,7 +273,7 @@ struct MiterLimit {
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct Font { struct Fonts {
private settings: RenderingContextSettings = new RenderingContextSettings(true) private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
...@@ -728,7 +728,7 @@ Fills a rectangle on the canvas. ...@@ -728,7 +728,7 @@ Fills a rectangle on the canvas.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct FillRect { struct FillRect {
...@@ -773,7 +773,8 @@ Draws an outlined rectangle on the canvas. ...@@ -773,7 +773,8 @@ Draws an outlined rectangle on the canvas.
- Example - Example
``` ```ts
// xxx.ets
@Entry @Entry
@Component @Component
struct StrokeRect { struct StrokeRect {
...@@ -818,7 +819,7 @@ Clears the content in a rectangle on the canvas. ...@@ -818,7 +819,7 @@ Clears the content in a rectangle on the canvas.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct ClearRect { struct ClearRect {
...@@ -864,7 +865,7 @@ Draws filled text on the canvas. ...@@ -864,7 +865,7 @@ Draws filled text on the canvas.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct FillText { struct FillText {
...@@ -908,7 +909,8 @@ Draws a text stroke on the canvas. ...@@ -908,7 +909,8 @@ Draws a text stroke on the canvas.
- Example - Example
``` ```ts
// xxx.ets
@Entry @Entry
@Component @Component
struct StrokeText { struct StrokeText {
...@@ -961,7 +963,7 @@ Returns a **TextMetrics** object used to obtain the width of specified text. ...@@ -961,7 +963,7 @@ Returns a **TextMetrics** object used to obtain the width of specified text.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct MeasureText { struct MeasureText {
...@@ -1004,7 +1006,8 @@ Strokes a path. ...@@ -1004,7 +1006,8 @@ Strokes a path.
- Example - Example
``` ```ts
// xxx.ets
@Entry @Entry
@Component @Component
struct Stroke { struct Stroke {
...@@ -1044,7 +1047,7 @@ Creates a drawing path. ...@@ -1044,7 +1047,7 @@ Creates a drawing path.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct BeginPath { struct BeginPath {
...@@ -1092,7 +1095,7 @@ Moves a drawing path to a target position on the canvas. ...@@ -1092,7 +1095,7 @@ Moves a drawing path to a target position on the canvas.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct MoveTo { struct MoveTo {
...@@ -1138,7 +1141,7 @@ Connects the current point to a target position using a straight line. ...@@ -1138,7 +1141,7 @@ Connects the current point to a target position using a straight line.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct LineTo { struct LineTo {
...@@ -1178,7 +1181,7 @@ Draws a closed path. ...@@ -1178,7 +1181,7 @@ Draws a closed path.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct ClosePath { struct ClosePath {
...@@ -1226,7 +1229,7 @@ Creates a pattern for image filling based on a specified source image and repeti ...@@ -1226,7 +1229,7 @@ Creates a pattern for image filling based on a specified source image and repeti
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct CreatePattern { struct CreatePattern {
...@@ -1276,7 +1279,7 @@ Draws a cubic bezier curve on the canvas. ...@@ -1276,7 +1279,7 @@ Draws a cubic bezier curve on the canvas.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct BezierCurveTo { struct BezierCurveTo {
...@@ -1324,7 +1327,7 @@ Draws a quadratic curve on the canvas. ...@@ -1324,7 +1327,7 @@ Draws a quadratic curve on the canvas.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct QuadraticCurveTo { struct QuadraticCurveTo {
...@@ -1374,7 +1377,7 @@ Draws an arc on the canvas. ...@@ -1374,7 +1377,7 @@ Draws an arc on the canvas.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct Arc { struct Arc {
...@@ -1422,7 +1425,7 @@ Draws an arc based on the radius and points on the arc. ...@@ -1422,7 +1425,7 @@ Draws an arc based on the radius and points on the arc.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct ArcTo { struct ArcTo {
...@@ -1474,7 +1477,7 @@ Draws an ellipse in the specified rectangular region. ...@@ -1474,7 +1477,7 @@ Draws an ellipse in the specified rectangular region.
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct CanvasExample { struct CanvasExample {
...@@ -1521,7 +1524,7 @@ Creates a rectangle. ...@@ -1521,7 +1524,7 @@ Creates a rectangle.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct CanvasExample { struct CanvasExample {
...@@ -1559,7 +1562,7 @@ Fills the area inside a closed path. ...@@ -1559,7 +1562,7 @@ Fills the area inside a closed path.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct Fill { struct Fill {
...@@ -1597,7 +1600,7 @@ Sets the current path to a clipping path. ...@@ -1597,7 +1600,7 @@ Sets the current path to a clipping path.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct Clip { struct Clip {
...@@ -1643,7 +1646,7 @@ Rotates a canvas clockwise around its coordinate axes. ...@@ -1643,7 +1646,7 @@ Rotates a canvas clockwise around its coordinate axes.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct Rotate { struct Rotate {
...@@ -1687,7 +1690,7 @@ Scales a canvas based on scale factors. ...@@ -1687,7 +1690,7 @@ Scales a canvas based on scale factors.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct Scale { struct Scale {
...@@ -1743,7 +1746,7 @@ Defines a transformation matrix. To transform a graph, you only need to set para ...@@ -1743,7 +1746,7 @@ Defines a transformation matrix. To transform a graph, you only need to set para
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct Transform { struct Transform {
...@@ -1797,7 +1800,7 @@ Resets the existing transformation matrix and creates a new transformation matri ...@@ -1797,7 +1800,7 @@ Resets the existing transformation matrix and creates a new transformation matri
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct SetTransform { struct SetTransform {
...@@ -1844,7 +1847,7 @@ Moves the origin of the coordinate system. ...@@ -1844,7 +1847,7 @@ Moves the origin of the coordinate system.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct Translate { struct Translate {
...@@ -1901,7 +1904,7 @@ Draws an image. ...@@ -1901,7 +1904,7 @@ Draws an image.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct Index { struct Index {
...@@ -2002,7 +2005,7 @@ Puts the [ImageData](ts-components-canvas-imagebitmap.md) onto a rectangular are ...@@ -2002,7 +2005,7 @@ Puts the [ImageData](ts-components-canvas-imagebitmap.md) onto a rectangular are
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct PutImageData { struct PutImageData {
...@@ -2046,7 +2049,7 @@ Restores the saved drawing context. ...@@ -2046,7 +2049,7 @@ Restores the saved drawing context.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct CanvasExample { struct CanvasExample {
...@@ -2081,7 +2084,7 @@ Saves the current drawing context. ...@@ -2081,7 +2084,7 @@ Saves the current drawing context.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct CanvasExample { struct CanvasExample {
...@@ -2124,7 +2127,7 @@ Creates a linear gradient. ...@@ -2124,7 +2127,7 @@ Creates a linear gradient.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct CreateLinearGradient { struct CreateLinearGradient {
...@@ -2177,7 +2180,7 @@ Creates a linear gradient. ...@@ -2177,7 +2180,7 @@ Creates a linear gradient.
- Example - Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
@Component @Component
struct CreateRadialGradient { struct CreateRadialGradient {
......
# Page Transition # Page Transition
> **NOTE**<br>
> This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
Customize the page transition animations by configuring the page entrance and exit components in the global **pageTransition** method. Customize the page transition animations by configuring the page entrance and exit components in the global **pageTransition** method.
## APIs > **NOTE**
>
> This event is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
| Name | Parameter | Description | | Name | Parameter | Description |
| -------- | -------- | -------- | | ------------------- | ------ | ------------------------------- |
| PageTransitionEnter | Object | Page entrance component, which is used to customize the entrance effect of the current page. For details, see animation parameters. | | PageTransitionEnter | Object | Page entrance component, which is used to customize the entrance effect of the current page. For details, see animation parameters.|
| PageTransitionExit | Object | Page exit component, which is used to customize the exit effect of the current page. For details, see animation parameters. | | PageTransitionExit | Object | Page exit component, which is used to customize the exit effect of the current page. For details, see animation parameters.|
- Animation parameters - Animation parameters
| Name | Type | Default Value | Mandatory | Description | | Name | Type | Default Value | Mandatory | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | ------------------------- | ------ | ---- | ---------------------------------------- |
| type | RouteType | - | No | If this parameter is not set, the reverse playback effect as pop switches to push is used. | | type | RouteType | - | No | Animation type. If this parameter is not set, the reverse playback effect as **pop** switches to **push** is used. |
| duration | number | 1000 | No | Animation duration, in ms. | | duration | number | 1000 | No | Animation duration, in ms. |
| curve | Curve \| Curves | Linear | No | Animation curve. For details about the valid values, see **Curve enums**. | | curve | Curve&nbsp;\|&nbsp;Curves | Linear | No | Animation curve. For details about the valid values, see [Curve](ts-animatorproperty.md).|
| delay | number | 0 | No | Animation delay, in ms. Delayed animation is disabled by default. | | delay | number | 0 | No | Animation delay, in ms. Delayed animation is disabled by default. |
- RouteType enums - RouteType enums
| Name | Description | | Name| Description |
| -------- | -------- | | ---- | ---------------- |
| Pop | When page A jumps to page B, page A is Exit+Push, and page B is Enter+Push. | | Pop | Redirects to a specified page.|
| Push | When page B returns to page A, page A is Enter+Pop, and page B is Exit+Pop. | | Push | Redirects to the next page.|
## Attributes ## Attributes
The **PageTransitionEnter** and **PageTransitionExit** components support the following attributes: The **PageTransitionEnter** and **PageTransitionExit** parameters support the following attributes:
| Name | Type | Default Value | Mandatory | Description | | Name | Type | Default Value | Mandatory | Description |
| -------- | -------- | -------- | -------- | -------- | | --------- | ---------------------------------------- | ----------------- | ---- | ---------------------------------------- |
| slide | SlideEffect | SlideEffect.Right | No | Slide effect during page transition. For details about the valid values, see **SlideEffect enums**. | | slide | SlideEffect | SlideEffect.Right | No | Slide effect during page transition. For details about the valid values, see **SlideEffect** enums. |
| translate | {<br/>x? : number,<br/>y? : number,<br/>z? : number<br/>} | - | No | Translation effect during page transition, which is the value of the start point of entrance and the end point of exit. When this parameter is set together with **slide**, the latter takes effect by default. | | translate | {<br>x?&nbsp;:&nbsp;number,<br>y?&nbsp;:&nbsp;number,<br>z?&nbsp;:&nbsp;number<br>} | - | No | Translation effect during page transition, which is the value of the start point of entrance and the end point of exit. When this parameter is set together with **slide**, the latter takes effect by default.|
| scale | {<br/>x? : number,<br/>y? : number,<br/>z? : number,<br/>centerX? : number,<br/>centerY? : number<br/>} | - | No | Scaling effect during page transition, which is the value of the start point of entrance and the end point of exit. | | scale | {<br>x?&nbsp;:&nbsp;number,<br>y?&nbsp;:&nbsp;number,<br>z?&nbsp;:&nbsp;number,<br>centerX?&nbsp;:&nbsp;number,<br>centerY?&nbsp;:&nbsp;number<br>} | - | No | Scaling effect during page transition, which is the value of the start point of entrance and the end point of exit. |
| opacity | number | 1 | No | Opacity, which is the opacity value of the start point of entrance or the end point of exit. | | opacity | number | 1 | No | Opacity, which is the opacity value of the start point of entrance or the end point of exit. |
- SlideEffect enums - SlideEffect enums
| Name | Description | | Name | Description |
| -------- | -------- | | ------ | ------------------------- |
| Left | When set to Enter, slides in from the left. When set to Exit, slides out to the left. | | Left | When set to Enter, slides in from the left. When set to Exit, slides out to the left.|
| Right | When set to Enter, slides in from the right. When set to Exit, slides out to the right. | | Right | When set to Enter, slides in from the right. When set to Exit, slides out to the right.|
| Top | When set to Enter, slides in from the top. When set to Exit, slides out to the top. | | Top | When set to Enter, slides in from the top. When set to Exit, slides out to the top.|
| Bottom | When set to Enter, slides in from the bottom. When set to Exit, slides out to the bottom. | | Bottom | When set to Enter, slides in from the bottom. When set to Exit, slides out to the bottom.|
## Events ## Events
The PageTransitionEnter and PageTransitionExit components support the following events: The **PageTransitionEnter** and **PageTransitionExit** parameters support the following events:
| Event | Description | | Name | Description |
| -------- | -------- | | ---------------------------------------- | ----------------------------------- |
| onEnter(type: RouteType, progress: number) =&gt; void | Callback invoked when page entrance occurs. The input parameter is the normalized progress of the current entrance animation. The value range is 0–1. | | onEnter(type:&nbsp;RouteType,&nbsp;progress:&nbsp;number)&nbsp;=&gt;&nbsp;void | The callback input parameter is the normalized progress of the current entrance animation. The value range is 0–1.|
| onExit(type: RouteType, progress: number) =&gt; void | Callback invoked when page exit occurs. The input parameter is the normalized progress of the current exit animation. The value range is 0–1. | | onExit(type:&nbsp;RouteType,&nbsp;progress:&nbsp;number)&nbsp;=&gt;&nbsp;void | The callback input parameter is the normalized progress of the current exit animation. The value range is 0–1.|
## Example ## Example
Customization method 1: The entrance animation of the current page is configured as fade-in, and the exit animation is configured as zoom-out. Customization method 1: The entrance animation of the current page is configured as fade-in, and the exit animation is configured as zoom-out.
```ts
```
// index.ets // index.ets
@Entry @Entry
@Component @Component
struct PageTransitionExample1 { struct PageTransitionExample1 {
@State scale: number = 1 @State scale1: number = 1
@State opacity: number = 1 @State opacity1: number = 1
@State active: boolean = false @State active: boolean = false
build() { build() {
Column() { Column() {
Navigator({ target: 'pages/page1', type: NavigationType.Push }) { Navigator({ target: 'pages/page1', type: NavigationType.Push }) {
...@@ -82,52 +80,52 @@ struct PageTransitionExample1 { ...@@ -82,52 +80,52 @@ struct PageTransitionExample1 {
.onClick(() => { .onClick(() => {
this.active = true this.active = true
}) })
}.scale({ x: this.scale }).opacity(this.opacity) }.scale({ x: this.scale1 }).opacity(this.opacity1)
} }
// Customization method 1: Customize the transition process. // Customization method 1: Customize the transition process.
pageTransition() { pageTransition() {
PageTransitionEnter({ duration: 1200, curve: Curve.Linear }) PageTransitionEnter({ duration: 1200, curve: Curve.Linear })
.onEnter((type: RouteType, progress: number) => { .onEnter((type: RouteType, progress: number) => {
this.scale = 1 this.scale1 = 1
this.opacity = progress this.opacity1 = progress
}) // The onEnter callback is triggered frame by frame during the entrance process. The input parameter is the normalized progress of the animation (0% to 100%). }) // The onEnter callback is triggered frame by frame during the entrance process. The input parameter is the normalized progress of the animation (0% to 100%).
PageTransitionExit({ duration: 1500, curve: Curve.Ease }) PageTransitionExit({ duration: 1500, curve: Curve.Ease })
.onExit((type: RouteType, progress: number) => { .onExit((type: RouteType, progress: number) => {
this.scale = 1 - progress this.scale1 = 1 - progress
this.opacity = 1 this.opacity1 = 1
}) // The onExit callback is triggered frame by frame during the exit process. The input parameter is the normalized progress of the animation (0% to 100%). }) // The onExit callback is triggered frame by frame during the exit process. The input parameter is the normalized progress of the animation (0% to 100%).
} }
} }
``` ```
```ts
```
// page1.ets // page1.ets
@Entry @Entry
@Component @Component
struct AExample { struct AExample {
@State scale: number = 1 @State scale2: number = 1
@State opacity: number = 1 @State opacity2: number = 1
@State active: boolean = false @State active: boolean = false
build() { build() {
Column() { Column() {
Navigator({ target: 'pages/index' ,type: NavigationType.Push}) { Navigator({ target: 'pages/index' ,type: NavigationType.Push}) {
Image($r('app.media.bg2')).width("100%").height("100%") Image($r('app.media.bg2')).width("100%").height("100%")
} }
}.height("100%").width("100%").scale({ x: this.scale }).opacity(this.opacity) }.height("100%").width("100%").scale({ x: this.scale2 }).opacity(this.opacity2)
} }
// Customization method 1: Customize the transition process. // Customization method 1: Customize the transition process.
pageTransition() { pageTransition() {
PageTransitionEnter({ duration: 1200, curve: Curve.Linear }) PageTransitionEnter({ duration: 1200, curve: Curve.Linear })
.onEnter((type: RouteType, progress: number) => { .onEnter((type: RouteType, progress: number) => {
this.scale = 1 this.scale2 = 1
this.opacity = progress this.opacity2 = progress
}) // The onEnter callback is triggered frame by frame during the entrance process. The input parameter is the normalized progress of the animation (0% to 100%). }) // The onEnter callback is triggered frame by frame during the entrance process. The input parameter is the normalized progress of the animation (0% to 100%).
PageTransitionExit({ duration: 1500, curve: Curve.Ease }) PageTransitionExit({ duration: 1500, curve: Curve.Ease })
.onExit((type: RouteType, progress: number) => { .onExit((type: RouteType, progress: number) => {
this.scale = 1 - progress this.scale2 = 1 - progress
this.opacity = 1 this.opacity2 = 1
}) // The onExit callback is triggered frame by frame during the exi process. The input parameter is the normalized progress of the animation (0% to 100%). }) // The onExit callback is triggered frame by frame during the exit process. The input parameter is the normalized progress of the animation (0% to 100%).
} }
} }
``` ```
...@@ -136,14 +134,13 @@ struct AExample { ...@@ -136,14 +134,13 @@ struct AExample {
Customization method 2: The entrance animation of the current page is configured to slide in from the left, and the exit animation is configured to zoom out with opacity change. Customization method 2: The entrance animation of the current page is configured to slide in from the left, and the exit animation is configured to zoom out with opacity change.
```ts
```
// index.ets // index.ets
@Entry @Entry
@Component @Component
struct PageTransitionExample { struct PageTransitionExample {
@State scale: number = 1 @State scale1: number = 1
@State opacity: number = 1 @State opacity1: number = 1
@State active: boolean = false @State active: boolean = false
build() { build() {
...@@ -154,7 +151,7 @@ struct PageTransitionExample { ...@@ -154,7 +151,7 @@ struct PageTransitionExample {
.onClick(() => { .onClick(() => {
this.active = true this.active = true
}) })
}.scale({ x: this.scale }).opacity(this.opacity) }.scale({ x: this.scale1 }).opacity(this.opacity1)
} }
// Customization method 2: Use the default effects provided by the system, such as translation, scaling, and opacity. // Customization method 2: Use the default effects provided by the system, such as translation, scaling, and opacity.
...@@ -168,14 +165,13 @@ struct PageTransitionExample { ...@@ -168,14 +165,13 @@ struct PageTransitionExample {
} }
``` ```
```ts
```
// page1.ets // page1.ets
@Entry @Entry
@Component @Component
struct PageTransitionExample1 { struct PageTransitionExample1 {
@State scale: number = 1 @State scale2: number = 1
@State opacity: number = 1 @State opacity2: number = 1
@State active: boolean = false @State active: boolean = false
build() { build() {
...@@ -186,7 +182,7 @@ struct PageTransitionExample1 { ...@@ -186,7 +182,7 @@ struct PageTransitionExample1 {
.onClick(() => { .onClick(() => {
this.active = true this.active = true
}) })
}.scale({ x: this.scale }).opacity(this.opacity) }.scale({ x: this.scale2 }).opacity(this.opacity2)
} }
// Customization method 2: Use the default effects provided by the system, such as translation, scaling, and opacity. // Customization method 2: Use the default effects provided by the system, such as translation, scaling, and opacity.
......
...@@ -63,7 +63,7 @@ struct Index { ...@@ -63,7 +63,7 @@ struct Index {
} }
``` ```
![zh-cn_image_borderImage](figures/borderImage.png) ![en-us_image_borderImage](figures/borderImage.png)
```ts ```ts
......
# Visibility # Visibility
The visibility attribute controls whether a component is visible.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**
> This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. >
> This event is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Required Permissions ## Required Permissions
...@@ -13,23 +15,23 @@ None ...@@ -13,23 +15,23 @@ None
## Attributes ## Attributes
| Name | Type | Default Value | Description | | Name| Type| Default Value| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| visibility | Visibility | Visibility.Visible | Whether the component is shown or hidden. | | visibility | Visibility | Visibility.Visible | Whether the component is visible. Note that even if a component is hidden, it needs to be re-created when the page is refreshed. Therefore, you are advised to use [conditional rendering](../../ui/ts-rending-control-syntax-if-else.md) instead under scenarios where consistently high performance is required. |
- Visibility enums - Visibility enums
| Name | Description | | Name| Description|
| -------- | -------- | | -------- | -------- |
| Hidden | The component is hidden, and a placeholder is used for it in the layout. | | Hidden | The component is hidden, and a placeholder is used for it in the layout.|
| Visible | The component is shown. | | Visible | The component is visible.|
| None | The component is hidden. It is not involved in the layout, and no placeholder is used for it. | | None | The component is hidden. It is not involved in the layout, and no placeholder is used for it.|
## Example ## Example
```ts
``` // xxx.ets
@Entry @Entry
@Component @Component
struct VisibilityExample { struct VisibilityExample {
...@@ -40,11 +42,11 @@ struct VisibilityExample { ...@@ -40,11 +42,11 @@ struct VisibilityExample {
Row().visibility(Visibility.Visible).width('90%').height(80).backgroundColor(0xAFEEEE) Row().visibility(Visibility.Visible).width('90%').height(80).backgroundColor(0xAFEEEE)
Text('None').fontSize(9).width('90%').fontColor(0xCCCCCC) Text('None').fontSize(9).width('90%').fontColor(0xCCCCCC)
// The component is hidden and no placeholder is used. // The component is hidden, and no placeholder is used.
Row().visibility(Visibility.None).width('90%').height(80).backgroundColor(0xAFEEEE) Row().visibility(Visibility.None).width('90%').height(80).backgroundColor(0xAFEEEE)
Text('Hidden').fontSize(9).width('90%').fontColor(0xCCCCCC) Text('Hidden').fontSize(9).width('90%').fontColor(0xCCCCCC)
// The component is hidden and a placeholder is used. // The component is hidden, and a placeholder is used for it in the layout.
Row().visibility(Visibility.Hidden).width('90%').height(80).backgroundColor(0xAFEEEE) Row().visibility(Visibility.Hidden).width('90%').height(80).backgroundColor(0xAFEEEE)
}.width('90%').border({ width: 1 }) }.width('90%').border({ width: 1 })
}.width('100%').margin({ top: 5 }) }.width('100%').margin({ top: 5 })
......
# Component Area Change Event # Component Area Change Event
The area change event is triggered when the component's size, position, or any other attribute that may affect its display area changes.
> ![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. > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
...@@ -12,20 +14,21 @@ None ...@@ -12,20 +14,21 @@ None
## Events ## Events
| Name | Bubble Supported | Description | | Name | Bubble Supported | Description |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| onAreaChange(event: (oldValue: Area, newValue: Area) =&gt; void) | No | Triggered when the component area changes. For details about the **Area** type, see **Area** attributes. | | onAreaChange(event: (oldValue: Area, newValue: Area) =&gt; void) | No | Triggered when the component area changes. For details about the **Area** type, see **Area** attributes. |
## Example ## Example
``` ```ts
// xxx.ets
@Entry @Entry
@Component @Component
struct AreaExample { struct AreaExample {
@State value: string = 'Text' @State value: string = 'Text'
@State size: string = '' @State size1: string = ''
build() { build() {
Column() { Column() {
...@@ -36,7 +39,7 @@ struct AreaExample { ...@@ -36,7 +39,7 @@ struct AreaExample {
}) })
.onAreaChange((oldValue: Area, newValue: Area) => { .onAreaChange((oldValue: Area, newValue: Area) => {
console.info(`Ace: on area change, oldValue is ${JSON.stringify(oldValue)} value is ${JSON.stringify(newValue)}`) console.info(`Ace: on area change, oldValue is ${JSON.stringify(oldValue)} value is ${JSON.stringify(newValue)}`)
this.size = JSON.stringify(newValue) this.size1 = JSON.stringify(newValue)
}) })
Text('new area is: \n' + this.size).margin({ right: 30, left: 30 }) Text('new area is: \n' + this.size).margin({ right: 30, left: 30 })
} }
......
...@@ -15,7 +15,7 @@ None ...@@ -15,7 +15,7 @@ None
| Name | Bubbling 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). | | onClick(callback: (event?: ClickEvent) =&gt; void) | No | Called when a click event occurs. For details about the event parameters, see **ClickEvent**. |
## ClickEvent ## ClickEvent
...@@ -41,8 +41,8 @@ None ...@@ -41,8 +41,8 @@ None
| -------- | -------- | -------- | | -------- | -------- | -------- |
| width | number | Width of the target element, in vp. | | width | number | Width of the target element, in vp. |
| height | number | Height 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. | | position | Position | 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. | | globalPosition | Position | Position of the upper left corner of the target element relative to that of the page. |
## Position<sup>8+</sup> ## Position<sup>8+</sup>
......
...@@ -22,15 +22,15 @@ None ...@@ -22,15 +22,15 @@ None
## KeyEvent ## KeyEvent
- Attributes - Attributes
| Name | Type | Description | | Name | Type | Description |
| -------- | -------- | -------- | | ------------------------------------- | --------------------------- | -------------------------- |
| type | [KeyType](#keytype-enums) | Type of a key. | | type | [KeyType](#keytype-enums) | Type of a key. |
| keyCode | number | Key code. | | [keyCode](../apis/js-apis-keycode.md) | number | Key code. |
| keyText | string | Key value. | | keyText | string | Key value. |
| keySource | [KeySource](#keysource-enums) | 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. | | 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. | | 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. | | timestamp | number | Timestamp when the key is pressed. |
- APIs - APIs
| Name | Description | | Name | Description |
...@@ -48,20 +48,10 @@ None ...@@ -48,20 +48,10 @@ None
## KeySource Enums ## KeySource Enums
| Name | Description | | Name | Description |
| -------- | -------- | | -------- | -------- |
| Unknown | Unknown input device. | | Unknown | Unknown input device. |
| [KeyCode](#common-keycode-enums) | The input device is a keyboard. | | Keyboard | 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 ## Example
......
# Standard Libraries Supported by Native APIs # Standard Libraries Supported by Native APIs
- [Standard Libraries](third_party_libc/musl.md) - [Node_API](third_party_napi/napi.md)
- [Native API Symbols Not Exported](third_party_libc/musl-peculiar-symbol.md) - [libuv](third_party_libuv/libuv.md)
- [Node_API](third_party_napi/napi.md) - [Native Standard Libraries Supported by Openharmony](third_party_libc/musl.md)
- [libuv](third_party_libuv/libuv.md) - Appendix
\ No newline at end of file - [Native API Symbols Not Exported](third_party_libc/musl-peculiar-symbol.md)
- [EGL Symbols Exported from Native APIs](third_party_opengl/egl-symbol.md)
- [OpenGL ES 3.0 Symbols Exported from Native APIs](third_party_opengl/openglesv3-symbol.md)
**Native API Symbols Not Exported** # Native API Symbols Not Exported
|Type|Symbol|Remarks| |Type|Symbol|Remarks|
| --- | --- | --- | | --- | --- | --- |
|OBJECT|___environ| |OBJECT|___environ||
|OBJECT|__daylight| |OBJECT|__daylight||
|OBJECT|__environ| |OBJECT|__environ||
|OBJECT|__hook_enable_hook_flag| |OBJECT|__hook_enable_hook_flag||
|OBJECT|__libc_malloc_default_dispatch| |OBJECT|__libc_malloc_default_dispatch||
|OBJECT|__musl_libc_globals| |OBJECT|__musl_libc_globals||
|OBJECT|__optpos| |OBJECT|__optpos||
|OBJECT|__optreset| |OBJECT|__optreset||
|OBJECT|__progname_full| |OBJECT|__progname_full||
|OBJECT|__signgam| |OBJECT|__signgam||
|OBJECT|__timezone| |OBJECT|__timezone||
|OBJECT|__tzname| |OBJECT|__tzname||
|OBJECT|_dl_debug_addr| |OBJECT|_dl_debug_addr||
|OBJECT|_environ| |OBJECT|_environ||
|OBJECT|function_of_shared_lib| |OBJECT|function_of_shared_lib||
|OBJECT|h_errno| |OBJECT|h_errno||
|OBJECT|ohos_malloc_hook_shared_liibrary| |OBJECT|ohos_malloc_hook_shared_liibrary||
|OBJECT|program_invocation_name| |OBJECT|program_invocation_name||
|OBJECT|program_invocation_short_name| |OBJECT|program_invocation_short_name||
|FUNC|__adjtime64| |FUNC|__adjtime64||
|FUNC|__aio_suspend_time64| |FUNC|__aio_suspend_time64||
|FUNC|__clock_gettime64| |FUNC|__clock_gettime64||
|FUNC|__ctype_b_loc| |FUNC|__ctype_b_loc||
|FUNC|__ctype_tolower_loc| |FUNC|__ctype_tolower_loc||
|FUNC|__ctype_toupper_loc| |FUNC|__ctype_toupper_loc||
|FUNC|__dls2b| |FUNC|__dls2b||
|FUNC|__dls3| |FUNC|__dls3||
|FUNC|__fgetwc_unlocked| |FUNC|__fgetwc_unlocked||
|FUNC|__flt_rounds| |FUNC|__flt_rounds||
|FUNC|__fputwc_unlocked| |FUNC|__fputwc_unlocked||
|FUNC|__freadahead| |FUNC|__freadahead||
|FUNC|__freadptr| |FUNC|__freadptr||
|FUNC|__freadptrinc| |FUNC|__freadptrinc||
|FUNC|__freelocale| |FUNC|__freelocale||
|FUNC|__fstat_time64| |FUNC|__fstat_time64||
|FUNC|__ftime64| |FUNC|__ftime64||
|FUNC|__fxstat64| |FUNC|__fxstat64||
|FUNC|__fxstatat64| |FUNC|__fxstatat64||
|FUNC|__getdelim| |FUNC|__getdelim||
|FUNC|__isalnum_l| |FUNC|__isalnum_l||
|FUNC|__isalpha_l| |FUNC|__isalpha_l||
|FUNC|__isblank_l| |FUNC|__isblank_l||
|FUNC|__iscntrl_l| |FUNC|__iscntrl_l||
|FUNC|__isdigit_l| |FUNC|__isdigit_l||
|FUNC|__isgraph_l| |FUNC|__isgraph_l||
|FUNC|__islower_l| |FUNC|__islower_l||
|FUNC|__isoc99_fscanf| |FUNC|__isoc99_fscanf||
|FUNC|__isoc99_fwscanf| |FUNC|__isoc99_fwscanf||
|FUNC|__isoc99_scanf| |FUNC|__isoc99_scanf||
|FUNC|__isoc99_sscanf| |FUNC|__isoc99_sscanf||
|FUNC|__isoc99_swscanf| |FUNC|__isoc99_swscanf||
|FUNC|__isoc99_vfscanf| |FUNC|__isoc99_vfscanf||
|FUNC|__isoc99_vfwscanf| |FUNC|__isoc99_vfwscanf||
|FUNC|__isoc99_vscanf| |FUNC|__isoc99_vscanf||
|FUNC|__isoc99_vsscanf| |FUNC|__isoc99_vsscanf||
|FUNC|__isoc99_vswscanf| |FUNC|__isoc99_vswscanf||
|FUNC|__isoc99_vwscanf| |FUNC|__isoc99_vwscanf||
|FUNC|__isoc99_wscanf| |FUNC|__isoc99_wscanf||
|FUNC|__isprint_l| |FUNC|__isprint_l||
|FUNC|__ispunct_l| |FUNC|__ispunct_l||
|FUNC|__isspace_l| |FUNC|__isspace_l||
|FUNC|__isupper_l| |FUNC|__isupper_l||
|FUNC|__iswalnum_l| |FUNC|__iswalnum_l||
|FUNC|__iswalpha_l| |FUNC|__iswalpha_l||
|FUNC|__iswblank_l| |FUNC|__iswblank_l||
|FUNC|__iswcntrl_l| |FUNC|__iswcntrl_l||
|FUNC|__iswctype_l| |FUNC|__iswctype_l||
|FUNC|__iswdigit_l| |FUNC|__iswdigit_l||
|FUNC|__iswgraph_l| |FUNC|__iswgraph_l||
|FUNC|__iswlower_l| |FUNC|__iswlower_l||
|FUNC|__iswprint_l| |FUNC|__iswprint_l||
|FUNC|__iswpunct_l| |FUNC|__iswpunct_l||
|FUNC|__iswspace_l| |FUNC|__iswspace_l||
|FUNC|__iswupper_l| |FUNC|__iswupper_l||
|FUNC|__iswxdigit_l| |FUNC|__iswxdigit_l||
|FUNC|__isxdigit_l| |FUNC|__isxdigit_l||
|FUNC|__lgammal_r| |FUNC|__lgammal_r||
|FUNC|__libc_free| |FUNC|__libc_free||
|FUNC|__libc_malloc| |FUNC|__libc_malloc||
|FUNC|__libc_start_main| |FUNC|__libc_start_main||
|FUNC|__lstat_time64| |FUNC|__lstat_time64||
|FUNC|__lxstat64| |FUNC|__lxstat64||
|FUNC|__mq_timedreceive_time64| |FUNC|__mq_timedreceive_time64||
|FUNC|__mq_timedsend_time64| |FUNC|__mq_timedsend_time64||
|FUNC|__nanosleep_time64| |FUNC|__nanosleep_time64||
|FUNC|__newlocale| |FUNC|__newlocale||
|FUNC|__nl_langinfo| |FUNC|__nl_langinfo||
|FUNC|__nl_langinfo_l| |FUNC|__nl_langinfo_l||
|FUNC|__overflow| |FUNC|__overflow||
|FUNC|__posix_getopt| |FUNC|__posix_getopt||
|FUNC|__pthread_cond_timedwait_time64| |FUNC|__pthread_cond_timedwait_time64||
|FUNC|__pthread_gettid_np| |FUNC|__pthread_gettid_np||
|FUNC|__pthread_timedjoin_np_time64| |FUNC|__pthread_timedjoin_np_time64||
|FUNC|__res_state| |FUNC|__res_state||
|FUNC|__setjmp| |FUNC|__setjmp||
|FUNC|__sigsetjmp| |FUNC|__sigsetjmp||
|FUNC|__stat_time64| |FUNC|__stat_time64||
|FUNC|__stime64| |FUNC|__stime64||
|FUNC|__strcasecmp_l| |FUNC|__strcasecmp_l||
|FUNC|__strcoll_l| |FUNC|__strcoll_l||
|FUNC|__strerror_l| |FUNC|__strerror_l||
|FUNC|__strncasecmp_l| |FUNC|__strncasecmp_l||
|FUNC|__strtod_l| |FUNC|__strtod_l||
|FUNC|__strtof_l| |FUNC|__strtof_l||
|FUNC|__strtoimax_internal| |FUNC|__strtoimax_internal||
|FUNC|__strtol_internal| |FUNC|__strtol_internal||
|FUNC|__strtold_l| |FUNC|__strtold_l||
|FUNC|__strtoll_internal| |FUNC|__strtoll_internal||
|FUNC|__strtoul_internal| |FUNC|__strtoul_internal||
|FUNC|__strtoull_internal| |FUNC|__strtoull_internal||
|FUNC|__strtoumax_internal| |FUNC|__strtoumax_internal||
|FUNC|__strxfrm_l| |FUNC|__strxfrm_l||
|FUNC|__sysv_signal| |FUNC|__sysv_signal||
|FUNC|__tolower_l| |FUNC|__tolower_l||
|FUNC|__toupper_l| |FUNC|__toupper_l||
|FUNC|__towctrans_l| |FUNC|__towctrans_l||
|FUNC|__towlower_l| |FUNC|__towlower_l||
|FUNC|__towupper_l| |FUNC|__towupper_l||
|FUNC|__uflow| |FUNC|__uflow||
|FUNC|__uselocale| |FUNC|__uselocale||
|FUNC|__utimensat_time64| |FUNC|__utimensat_time64||
|FUNC|__wait3_time64| |FUNC|__wait3_time64||
|FUNC|__wcscoll_l| |FUNC|__wcscoll_l||
|FUNC|__wcsftime_l| |FUNC|__wcsftime_l||
|FUNC|__wcsxfrm_l| |FUNC|__wcsxfrm_l||
|FUNC|__wctrans_l| |FUNC|__wctrans_l||
|FUNC|__wctype_l| |FUNC|__wctype_l||
|FUNC|__xmknod| |FUNC|__xmknod||
|FUNC|__xmknodat| |FUNC|__xmknodat||
|FUNC|__xpg_basename| |FUNC|__xpg_basename||
|FUNC|__xpg_strerror_r| |FUNC|__xpg_strerror_r||
|FUNC|__xstat64| |FUNC|__xstat64||
|FUNC|_dl_debug_state| |FUNC|_dl_debug_state||
|FUNC|_dlstart| |FUNC|_dlstart||
|FUNC|_fini| |FUNC|_fini||
|FUNC|_init| |FUNC|_init||
|FUNC|_IO_feof_unlocked| |FUNC|_IO_feof_unlocked||
|FUNC|_IO_ferror_unlocked| |FUNC|_IO_ferror_unlocked||
|FUNC|_IO_getc| |FUNC|_IO_getc||
|FUNC|_IO_getc_unlocked| |FUNC|_IO_getc_unlocked||
|FUNC|_IO_putc| |FUNC|_IO_putc||
|FUNC|_IO_putc_unlocked| |FUNC|_IO_putc_unlocked||
|FUNC|a64l| |FUNC|a64l||
|FUNC|addmntent| |FUNC|addmntent||
|FUNC|adjtime| |FUNC|adjtime||
|FUNC|aio_cancel| |FUNC|aio_cancel||
|FUNC|aio_cancel64| |FUNC|aio_cancel64||
|FUNC|aio_error| |FUNC|aio_error||
|FUNC|aio_error64| |FUNC|aio_error64||
|FUNC|aio_fsync| |FUNC|aio_fsync||
|FUNC|aio_fsync64| |FUNC|aio_fsync64||
|FUNC|aio_read| |FUNC|aio_read||
|FUNC|aio_read64| |FUNC|aio_read64||
|FUNC|aio_return| |FUNC|aio_return||
|FUNC|aio_return64| |FUNC|aio_return64||
|FUNC|aio_suspend| |FUNC|aio_suspend||
|FUNC|aio_suspend64| |FUNC|aio_suspend64||
|FUNC|aio_write| |FUNC|aio_write||
|FUNC|aio_write64| |FUNC|aio_write64||
|FUNC|bcmp| |FUNC|bcmp||
|FUNC|bind_textdomain_codeset| |FUNC|bind_textdomain_codeset||
|FUNC|bindtextdomain| |FUNC|bindtextdomain||
|FUNC|confstr| |FUNC|confstr||
|FUNC|copy_file_range| |FUNC|copy_file_range||
|FUNC|crypt| |FUNC|crypt||
|FUNC|crypt_r| |FUNC|crypt_r||
|FUNC|cuserid| |FUNC|cuserid||
|FUNC|dcgettext| |FUNC|dcgettext||
|FUNC|dcngettext| |FUNC|dcngettext||
|FUNC|dgettext| |FUNC|dgettext||
|FUNC|dlinfo| |FUNC|dlinfo||
|FUNC|dngettext| |FUNC|dngettext||
|FUNC|eaccess| |FUNC|eaccess||
|FUNC|ecvt| |FUNC|ecvt||
|FUNC|encrypt| |FUNC|encrypt||
|FUNC|endspent| |FUNC|endspent||
|FUNC|endusershell| |FUNC|endusershell||
|FUNC|endutxent| |FUNC|endutxent||
|FUNC|ether_hostton| |FUNC|ether_hostton||
|FUNC|ether_line| |FUNC|ether_line||
|FUNC|ether_ntohost| |FUNC|ether_ntohost||
|FUNC|euidaccess| |FUNC|euidaccess||
|FUNC|exp10| |FUNC|exp10||
|FUNC|exp10f| |FUNC|exp10f||
|FUNC|exp10l| |FUNC|exp10l||
|FUNC|explicit_bzero| |FUNC|explicit_bzero||
|FUNC|fanotify_init| |FUNC|fanotify_init||
|FUNC|fanotify_mark| |FUNC|fanotify_mark||
|FUNC|fcvt| |FUNC|fcvt||
|FUNC|fgetgrent| |FUNC|fgetgrent||
|FUNC|fgetpwent| |FUNC|fgetpwent||
|FUNC|fgetspent| |FUNC|fgetspent||
|FUNC|fgetwc_unlocked| |FUNC|fgetwc_unlocked||
|FUNC|fgetws_unlocked| |FUNC|fgetws_unlocked||
|FUNC|finish_install_ohos_malloc_hooks| |FUNC|finish_install_ohos_malloc_hooks||
|FUNC|fmtmsg| |FUNC|fmtmsg||
|FUNC|fopencookie| |FUNC|fopencookie||
|FUNC|fputwc_unlocked| |FUNC|fputwc_unlocked||
|FUNC|fputws_unlocked| |FUNC|fputws_unlocked||
|FUNC|gcvt| |FUNC|gcvt||
|FUNC|get_current_dir_name| |FUNC|get_current_dir_name||
|FUNC|getdate| |FUNC|getdate||
|FUNC|getdents64| |FUNC|getdents64||
|FUNC|gethostid| |FUNC|gethostid||
|FUNC|getpass| |FUNC|getpass||
|FUNC|getservbyname_r| |FUNC|getservbyname_r||
|FUNC|getservbyport_r| |FUNC|getservbyport_r||
|FUNC|getspent| |FUNC|getspent||
|FUNC|getspnam| |FUNC|getspnam||
|FUNC|getspnam_r| |FUNC|getspnam_r||
|FUNC|gettext| |FUNC|gettext||
|FUNC|getusershell| |FUNC|getusershell||
|FUNC|getutid| |FUNC|getutid||
|FUNC|getutline| |FUNC|getutline||
|FUNC|getutxent| |FUNC|getutxent||
|FUNC|getutxid| |FUNC|getutxid||
|FUNC|getutxline| |FUNC|getutxline||
|FUNC|getw| |FUNC|getw||
|FUNC|getwc_unlocked| |FUNC|getwc_unlocked||
|FUNC|getwchar_unlocked| |FUNC|getwchar_unlocked||
|FUNC|glob64| |FUNC|glob64||
|FUNC|globfree64| |FUNC|globfree64||
|FUNC|init_malloc_hook_shared_library| |FUNC|init_malloc_hook_shared_library||
|FUNC|isastream| |FUNC|isastream||
|FUNC|l64a| |FUNC|l64a||
|FUNC|lchmod| |FUNC|lchmod||
|FUNC|lckpwdf| |FUNC|lckpwdf||
|FUNC|lio_listio| |FUNC|lio_listio||
|FUNC|lio_listio64| |FUNC|lio_listio64||
|FUNC|load_malloc_hook_shared_library| |FUNC|load_malloc_hook_shared_library||
|FUNC|log_print| |FUNC|log_print||
|FUNC|membarrier| |FUNC|membarrier||
|FUNC|mq_close| |FUNC|mq_close||
|FUNC|mq_getattr| |FUNC|mq_getattr||
|FUNC|mq_notify| |FUNC|mq_notify||
|FUNC|mq_open| |FUNC|mq_open||
|FUNC|mq_receive| |FUNC|mq_receive||
|FUNC|mq_send| |FUNC|mq_send||
|FUNC|mq_setattr| |FUNC|mq_setattr||
|FUNC|mq_timedreceive| |FUNC|mq_timedreceive||
|FUNC|mq_timedsend| |FUNC|mq_timedsend||
|FUNC|mq_unlink| |FUNC|mq_unlink||
|FUNC|name_to_handle_at| |FUNC|name_to_handle_at||
|FUNC|ngettext| |FUNC|ngettext||
|FUNC|ohos_malloc_hook_init_function| |FUNC|ohos_malloc_hook_init_function||
|FUNC|open_by_handle_at| |FUNC|open_by_handle_at||
|FUNC|pivot_root| |FUNC|pivot_root||
|FUNC|posix_close| |FUNC|posix_close||
|FUNC|posix_spawn_file_actions_addchdir_np| |FUNC|posix_spawn_file_actions_addchdir_np||
|FUNC|posix_spawn_file_actions_addfchdir_np| |FUNC|posix_spawn_file_actions_addfchdir_np||
|FUNC|pow10| |FUNC|pow10||
|FUNC|pow10f| |FUNC|pow10f||
|FUNC|pow10l| |FUNC|pow10l||
|FUNC|pthread_cancel| |FUNC|pthread_cancel||
|FUNC|pthread_getaffinity_np| |FUNC|pthread_getaffinity_np||
|FUNC|pthread_getattr_default_np| |FUNC|pthread_getattr_default_np||
|FUNC|pthread_getconcurrency| |FUNC|pthread_getconcurrency||
|FUNC|pthread_mutex_consistent| |FUNC|pthread_mutex_consistent||
|FUNC|pthread_mutex_getprioceiling| |FUNC|pthread_mutex_getprioceiling||
|FUNC|pthread_mutex_setprioceiling| |FUNC|pthread_mutex_setprioceiling||
|FUNC|pthread_mutexattr_getrobust| |FUNC|pthread_mutexattr_getrobust||
|FUNC|pthread_mutexattr_setrobust| |FUNC|pthread_mutexattr_setrobust||
|FUNC|pthread_setaffinity_np| |FUNC|pthread_setaffinity_np||
|FUNC|pthread_setattr_default_np| |FUNC|pthread_setattr_default_np||
|FUNC|pthread_setcancelstate| |FUNC|pthread_setcancelstate||
|FUNC|pthread_setcanceltype| |FUNC|pthread_setcanceltype||
|FUNC|pthread_setconcurrency| |FUNC|pthread_setconcurrency||
|FUNC|pthread_testcancel| |FUNC|pthread_testcancel||
|FUNC|pthread_timedjoin_np| |FUNC|pthread_timedjoin_np||
|FUNC|pthread_tryjoin_np| |FUNC|pthread_tryjoin_np||
|FUNC|putgrent| |FUNC|putgrent||
|FUNC|putpwent| |FUNC|putpwent||
|FUNC|putspent| |FUNC|putspent||
|FUNC|pututxline| |FUNC|pututxline||
|FUNC|putwc_unlocked| |FUNC|putwc_unlocked||
|FUNC|putwchar_unlocked| |FUNC|putwchar_unlocked||
|FUNC|remap_file_pages| |FUNC|remap_file_pages||
|FUNC|rindex| |FUNC|rindex||
|FUNC|secure_getenv| |FUNC|secure_getenv||
|FUNC|setkey| |FUNC|setkey||
|FUNC|setspent| |FUNC|setspent||
|FUNC|setusershell| |FUNC|setusershell||
|FUNC|setutxent| |FUNC|setutxent||
|FUNC|shm_open| |FUNC|shm_open||
|FUNC|shm_unlink| |FUNC|shm_unlink||
|FUNC|sigandset| |FUNC|sigandset||
|FUNC|sigisemptyset| |FUNC|sigisemptyset||
|FUNC|sigorset| |FUNC|sigorset||
|FUNC|sockatmark| |FUNC|sockatmark||
|FUNC|stime| |FUNC|stime||
|FUNC|strfmon| |FUNC|strfmon||
|FUNC|strfmon_l| |FUNC|strfmon_l||
|FUNC|strverscmp| |FUNC|strverscmp||
|FUNC|textdomain| |FUNC|textdomain||
|FUNC|ualarm| |FUNC|ualarm||
|FUNC|ulckpwdf| |FUNC|ulckpwdf||
|FUNC|ulimit| |FUNC|ulimit||
|FUNC|updwtmp| |FUNC|updwtmp||
|FUNC|updwtmpx| |FUNC|updwtmpx||
|FUNC|utmpxname| |FUNC|utmpxname||
|FUNC|versionsort| |FUNC|versionsort||
|FUNC|versionsort64| |FUNC|versionsort64||
|FUNC|vhangup| |FUNC|vhangup||
|FUNC|wordexp| |FUNC|wordexp||
|FUNC|wordfree| |FUNC|wordfree||
\ No newline at end of file
# Native Standard Libraries Supported by OpenHarmony # Native Standard Libraries Supported by OpenHarmony
## Overview ## Overview
**Table 1** Standard libraries supported by OpenHarmony **Table 1** Standard libraries supported by OpenHarmony
| Library | Description | | Library | Description |
...@@ -13,14 +9,12 @@ ...@@ -13,14 +9,12 @@
| C standard library | C11 standard library implemented by [libc, libm, and libdl](https://en.cppreference.com/w/c/header). | | C standard library | C11 standard library implemented by [libc, libm, and libdl](https://en.cppreference.com/w/c/header). |
| C++ standard library ([libc++](https://libcxx.llvm.org/))| An implementation of the C++ standard library. | | C++ standard library ([libc++](https://libcxx.llvm.org/))| An implementation of the C++ standard library. |
| Open Sound Library for Embedded Systems ([OpenSL ES](https://www.khronos.org/registry/OpenSL-ES/))| An embedded, cross-platform audio processing library.| | Open Sound Library for Embedded Systems ([OpenSL ES](https://www.khronos.org/registry/OpenSL-ES/))| An embedded, cross-platform audio processing library.|
| [zlib](https://zlib.net/) | A general data compression library implemented in C/C++.| | [zlib](https://zlib.net/) | A general data compression library implemented in C/C++.|
| [EGL](https://www.khronos.org/egl/) | A standard software interface between rendering APIs and the underlying native window system.| | [EGL](https://www.khronos.org/egl/) | A standard software interface between rendering APIs and the underlying native window system.|
| Open Graphics Library for Embedded Systems ([OpenGL ES](https://www.khronos.org/opengles/))| A cross-platform software interface for rendering 3D graphics on embedded and mobile systems.| | Open Graphics Library for Embedded Systems ([OpenGL ES](https://www.khronos.org/opengles/))| A cross-platform software interface for rendering 3D graphics on embedded and mobile systems.|
## C Standard Library ## C Standard Library
The C standard library is a C11 standard library implemented by: The C standard library is a C11 standard library implemented by:
libc: provides thread-related functions and a majority of standard functions. libc: provides thread-related functions and a majority of standard functions.
...@@ -43,8 +37,6 @@ C standard library includes a set of header files in accordance with standard C ...@@ -43,8 +37,6 @@ C standard library includes a set of header files in accordance with standard C
## libc++ ## libc++
[libc++](https://libcxx.llvm.org/) is an implementation of the C++ standard library. [libc++](https://libcxx.llvm.org/) is an implementation of the C++ standard library.
**Version** **Version**
...@@ -57,24 +49,12 @@ The C++11 and C++14 standards are supported, and the C++17 and C++20 standards a ...@@ -57,24 +49,12 @@ The C++11 and C++14 standards are supported, and the C++17 and C++20 standards a
## OpenSL ES ## OpenSL ES
[OpenSL ES](https://www.khronos.org/registry/OpenSL-ES/) is an embedded, cross-platform audio processing library. [OpenSL ES](https://www.khronos.org/registry/OpenSL-ES/) is an embedded, cross-platform audio processing library.
## zlib ## zlib
[zlib](https://zlib.net/) is a general data compression library implemented in C/C++. [zlib](https://zlib.net/) is a general data compression library implemented in C/C++.
## EGL ## EGL
EGL is an interface between Khronos rendering APIs (such as OpenGL ES and OpenVG) and the underlying native window system. OpenHarmony supports EGL. EGL is an interface between Khronos rendering APIs (such as OpenGL ES and OpenVG) and the underlying native window system. OpenHarmony supports EGL.
...@@ -83,8 +63,6 @@ EGL is an interface between Khronos rendering APIs (such as OpenGL ES and OpenVG ...@@ -83,8 +63,6 @@ EGL is an interface between Khronos rendering APIs (such as OpenGL ES and OpenVG
[EGL Symbols Exported from Native APIs](../third_party_opengl/egl-symbol.md) [EGL Symbols Exported from Native APIs](../third_party_opengl/egl-symbol.md)
## OpenGL ES ## OpenGL ES
OpenGL is a cross-platform software interface for 3D graphics processing. [OpenGL ES](https://www.khronos.org/opengles/) is a OpenGL specification for embedded devices. OpenHarmony supports OpenGL ES 3.0. OpenGL is a cross-platform software interface for 3D graphics processing. [OpenGL ES](https://www.khronos.org/opengles/) is a OpenGL specification for embedded devices. OpenHarmony supports OpenGL ES 3.0.
......
**EGL Symbols Exported from Native APIs** # Native api中导出的EGL符号列表
|Type|Symbol|Remarks| |符号类型|符号名|备注|
| --- | --- | --- | | --- | --- | --- |
|FUNC|eglChooseConfig| |FUNC|eglChooseConfig||
|FUNC|eglCopyBuffers| |FUNC|eglCopyBuffers||
|FUNC|eglCreateContext| |FUNC|eglCreateContext||
|FUNC|eglCreatePbufferSurface| |FUNC|eglCreatePbufferSurface||
|FUNC|eglCreatePixmapSurface| |FUNC|eglCreatePixmapSurface||
|FUNC|eglCreateWindowSurface| |FUNC|eglCreateWindowSurface||
|FUNC|eglDestroyContext| |FUNC|eglDestroyContext||
|FUNC|eglDestroySurface| |FUNC|eglDestroySurface||
|FUNC|eglGetConfigAttrib| |FUNC|eglGetConfigAttrib||
|FUNC|eglGetConfigs| |FUNC|eglGetConfigs||
|FUNC|eglGetCurrentDisplay| |FUNC|eglGetCurrentDisplay||
|FUNC|eglGetCurrentSurface| |FUNC|eglGetCurrentSurface||
|FUNC|eglGetDisplay| |FUNC|eglGetDisplay||
|FUNC|eglGetError| |FUNC|eglGetError||
|FUNC|eglGetProcAddress| |FUNC|eglGetProcAddress||
|FUNC|eglInitialize| |FUNC|eglInitialize||
|FUNC|eglMakeCurrent| |FUNC|eglMakeCurrent||
|FUNC|eglQueryContext| |FUNC|eglQueryContext||
|FUNC|eglQueryString| |FUNC|eglQueryString||
|FUNC|eglQuerySurface| |FUNC|eglQuerySurface||
|FUNC|eglSwapBuffers| |FUNC|eglSwapBuffers||
|FUNC|eglTerminate| |FUNC|eglTerminate||
|FUNC|eglWaitGL| |FUNC|eglWaitGL||
|FUNC|eglWaitNative| |FUNC|eglWaitNative||
|FUNC|eglBindTexImage| |FUNC|eglBindTexImage||
|FUNC|eglReleaseTexImage| |FUNC|eglReleaseTexImage||
|FUNC|eglSurfaceAttrib| |FUNC|eglSurfaceAttrib||
|FUNC|eglSwapInterval| |FUNC|eglSwapInterval||
|FUNC|eglBindAPI| |FUNC|eglBindAPI||
|FUNC|eglQueryAPI| |FUNC|eglQueryAPI||
|FUNC|eglCreatePbufferFromClientBuffer| |FUNC|eglCreatePbufferFromClientBuffer||
|FUNC|eglReleaseThread| |FUNC|eglReleaseThread||
|FUNC|eglWaitClient| |FUNC|eglWaitClient||
|FUNC|eglGetCurrentContext| |FUNC|eglGetCurrentContext||
|FUNC|eglCreateSync| |FUNC|eglCreateSync||
|FUNC|eglDestroySync| |FUNC|eglDestroySync||
|FUNC|eglClientWaitSync| |FUNC|eglClientWaitSync||
|FUNC|eglGetSyncAttrib| |FUNC|eglGetSyncAttrib||
|FUNC|eglCreateImage| |FUNC|eglCreateImage||
|FUNC|eglDestroyImage| |FUNC|eglDestroyImage||
|FUNC|eglGetPlatformDisplay| |FUNC|eglGetPlatformDisplay||
|FUNC|eglCreatePlatformWindowSurface| |FUNC|eglCreatePlatformWindowSurface||
|FUNC|eglCreatePlatformPixmapSurface| |FUNC|eglCreatePlatformPixmapSurface||
|FUNC|eglWaitSync| |FUNC|eglWaitSync||
...@@ -21,12 +21,12 @@ ArkUI is a UI development framework that provides what you'll need to develop ap ...@@ -21,12 +21,12 @@ ArkUI is a UI development framework that provides what you'll need to develop ap
- Drawing: ArkUI offers advanced drawing capabilities that allow you to draw custom shapes with a range of editors, from images to fill colors and texts. - Drawing: ArkUI offers advanced drawing capabilities that allow you to draw custom shapes with a range of editors, from images to fill colors and texts.
- Interaction: ArkUI allows users to interact with your application UI properly, regardless of the system platform and input device. By default, the UI accepts input from touch gestures, remote controls, and mouse devices, with support for the event notification capability. - Interaction: ArkUI allows users to interact with your application UI properly, regardless of the system platform and input device. By default, the UI accepts input from touch gestures, remote controls, and mouse devices, with support for the event notification capability.
- Platform API channel: ArkUI provides an API extension mechanism through which platform capabilities are encapsulated to produce JavaScript APIs in a unified style. - Platform API channel: ArkUI provides an API extension mechanism through which platform capabilities are encapsulated to produce JavaScript APIs in a unified style.
- Two development paradigms: ArkUI comes with two development paradigms: JavaScript-based web-like development paradigm (web-like development paradigm for short) and TypeScript-based declarative development paradigm (declarative development paradigm for short). You can choose whichever development paradigm that aligns with your practice. - Two development paradigms: ArkUI comes with two development paradigms: TypeScript-based declarative development paradigm (declarative development paradigm for short) and JavaScript-based web-like development paradigm (web-like development paradigm for short). You can choose whichever development paradigm that aligns with your practice.
| Development Paradigm | Description | Applicable To | Intended Audience | | Development Paradigm | Description | Applicable To | Intended Audience |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| Web-like development paradigm | Uses the classical three-stage programming model, in which OpenHarmony Markup Language (HML) is used for building layouts, CSS for defining styles, and JavaScript for adding processing logic. UI components are associated with data through one-way data-binding. This means that when data changes, the UI automatically updates with the new data. This development paradigm has a low learning curve for frontend web developers, allowing them to quickly transform existing web applications into ArkUI applications. | Small- and medium-sized applications and service widgets with simple UIs | Frontend web developers |
| Declarative development paradigm | Uses the TypeScript programming language and extends the declarative UI syntax, providing UI drawing capabilities from three dimensions: component, animation, and state management. The programming mode used is closer to natural semantics. You can intuitively describe the UI without caring about how the framework implements UI drawing and rendering, leading to simplified and efficient development. With type annotations in TypeScript, you can enforce type checking at compile time. | Applications involving technological sophistication and teamwork | Mobile application and system application developers | | Declarative development paradigm | Uses the TypeScript programming language and extends the declarative UI syntax, providing UI drawing capabilities from three dimensions: component, animation, and state management. The programming mode used is closer to natural semantics. You can intuitively describe the UI without caring about how the framework implements UI drawing and rendering, leading to simplified and efficient development. With type annotations in TypeScript, you can enforce type checking at compile time. | Applications involving technological sophistication and teamwork | Mobile application and system application developers |
| Web-like development paradigm | Uses the classical three-stage programming model, in which OpenHarmony Markup Language (HML) is used for building layouts, CSS for defining styles, and JavaScript for adding processing logic. UI components are associated with data through one-way data-binding. This means that when data changes, the UI automatically updates with the new data. This development paradigm has a low learning curve for frontend web developers, allowing them to quickly transform existing web applications into ArkUI applications. | Small- and medium-sized applications and service widgets with simple UIs | Frontend web developers |
### Framework Structure ### Framework Structure
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
The following figure shows the typical directory structure of the JavaScript module \(**entry/src/main/js/module**\) for an application with feature abilities \(FA\) using JavaScript APIs. The following figure shows the typical directory structure of the JavaScript module \(**entry/src/main/js/module**\) for an application with feature abilities \(FA\) using JavaScript APIs.
**Figure 1** Directory structure **Figure 1** Directory structure
![](figures/unnaming-(1).png) ![unnaming-(1)](figures/unnaming-(1).png)
**Figure 2** Directory structure for resource sharing<sup>5+</sup> **Figure 2** Directory structure for resource sharing<sup>5+</sup>
![](figures/directory-structure-for-resource-sharing-5+.png "directory-structure-for-resource-sharing-5+") ![directory-structure-for-resource-sharing-5+](figures/directory-structure-for-resource-sharing-5+.png)
Functions of the files are as follows: Functions of the files are as follows:
...@@ -20,13 +20,14 @@ Functions of the files are as follows: ...@@ -20,13 +20,14 @@ Functions of the files are as follows:
Functions of the folders are as follows: Functions of the folders are as follows:
- The **app.js** file manages global JavaScript logics and application lifecycle. For details, see [app.js](js-framework-js-file.md). - The **app.js** file manages global JavaScript logics and application lifecycle. For details, see [app.js](js-framework-js-file.md).
- The **pages** directory stores all component pages. - The **pages** directory stores all component pages.
- The **common** directory stores public resource files, such as media resources, custom components, and .js files. - The **common** directory stores public resource files, such as media resources, custom components, and .js files.
- The **resources** directory stores resource configuration files, for example, for multi-resolution loading. For details, see [Resource Limitations and Access](js-framework-resource-restriction.md). - The **resources** directory stores resource configuration files, for example, for multi-resolution loading. For details, see [Resource Limitations and Access](js-framework-resource-restriction.md).
- The **share** directory<sup>5+</sup> is used to configure resources shared by multiple instances. For example, images and JSON files in this directory can be shared by **default1** and **default2** instances. - The **share** directory<sup>5+</sup> is used to configure resources shared by multiple instances. For example, images and JSON files in this directory can be shared by **default1** and **default2** instances.
>![](public_sys-resources/icon-note.gif) **NOTE** >**NOTE**
>
>- Reserved folders \(**i18n** and **resources**\) cannot be renamed. >- Reserved folders \(**i18n** and **resources**\) cannot be renamed.
>- If the same resource name and directory are used under the share directory and the instance \(**default**\) directory, the resource in the instance directory will be used when you reference the directory. >- If the same resource name and directory are used under the share directory and the instance \(**default**\) directory, the resource in the instance directory will be used when you reference the directory.
>- The **share** directory does not support **i18n**. >- The **share** directory does not support **i18n**.
...@@ -38,10 +39,10 @@ Application resources can be accessed via an absolute or relative path. In the J ...@@ -38,10 +39,10 @@ Application resources can be accessed via an absolute or relative path. In the J
- To reference a code file, use a relative path, for example, **../common/utils.js**. - To reference a code file, use a relative path, for example, **../common/utils.js**.
- To reference a resource file, use an absolute path, for example, **/common/xxx.png**. - To reference a resource file, use an absolute path, for example, **/common/xxx.png**.
- Store code files and resource files in the common directory and access the files in a required fashion. - Store code files and resource files in the **common** directory and access the files in a required fashion.
- In a .css file, use the url\(\) function to create a URL, for example, **url\(/common/xxx.png\)**. - In a .css file, use the url\(\) function to create a URL, for example, **url\(/common/xxx.png\)**.
>![](public_sys-resources/icon-note.gif) **NOTE** >**NOTE**
> >
>When code file A needs to reference code file B: >When code file A needs to reference code file B:
> >
...@@ -51,7 +52,7 @@ Application resources can be accessed via an absolute or relative path. In the J ...@@ -51,7 +52,7 @@ Application resources can be accessed via an absolute or relative path. In the J
## Media File Formats ## Media File Formats
Table 1 Supported image formats **Table 1** Supported image formats
| Image Format | File Format | | Image Format | File Format |
| ------------ | ----------- | | ------------ | ----------- |
...@@ -61,7 +62,7 @@ Table 1 Supported image formats ...@@ -61,7 +62,7 @@ Table 1 Supported image formats
| PNG | .png | | PNG | .png |
| WebP | .webp | | WebP | .webp |
Table 2 Supported video formats **Table 2** Supported video formats
| Video Format | File Format | | Video Format | File Format |
| ------------------------------- | ----------- | | ------------------------------- | ----------- |
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
## Application Lifecycle ## Application Lifecycle
You can customize the [lifecycle](js-framework-lifecycle.md) implementation logic on an application-by-application basis in app.js. The following example only prints the corresponding logs in the lifecycle function: You can customize the [lifecycle](../ui/js-framework-lifecycle.md) implementation logic on an application-by-application basis in app.js. The following example only prints the corresponding logs in the lifecycle function:
``` ```js
// app.js // app.js
export default { export default {
onCreate() { onCreate() {
...@@ -20,14 +20,13 @@ export default { ...@@ -20,14 +20,13 @@ export default {
## Application Object<sup>6+</sup> ## Application Object<sup>6+</sup>
| Attribute | Data Type | Description | | Attribute | Data Type | Description |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| getApp | Function | Obtains the object exposed in the app.js file from the custom .js file. | | getApp | Function | Obtains the object exposed in the **app.js** file from the custom .js file. |
The following is a sample code snippet: The following is a sample code snippet:
```js
```
// app.js // app.js
export default { export default {
data: { data: {
...@@ -43,7 +42,7 @@ export default { ...@@ -43,7 +42,7 @@ export default {
``` ```
``` ```js
// test.js Customize the logic code. // test.js Customize the logic code.
export var appData = getApp().data; export var appData = getApp().data;
``` ```
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册