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

!8690 翻译完成 8559/8563/7429/7395/7383/7345/6232

Merge pull request !8690 from ester.zhou/C2-0825-2
# Work Scheduler Callbacks
> **NOTE**<br/>
> 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 **WorkSchedulerExtensionAbility** module provides callbacks for Work Scheduler tasks.
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
```
```ts
import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility'
```
......@@ -20,13 +26,13 @@ Triggered when the Work Scheduler task starts.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | --------------------- | ---- | -------------- |
| work | [workScheduler.WorkInfo](js-apis-workScheduler.md#workinfo) | Yes | Task to be added to the execution queue.|
| Name | Type | Mandatory | Description |
| ---- | ---------------------------------------- | ---- | -------------- |
| work | [workScheduler.WorkInfo](js-apis-workScheduler.md#workinfo) | Yes | Target task. |
**Example**
```
```ts
export default class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility {
onWorkStart(workInfo) {
console.log('MyWorkSchedulerExtensionAbility onWorkStart' + JSON.stringify(workInfo));
......@@ -44,14 +50,14 @@ Triggered when the Work Scheduler task stops.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | --------------------- | ---- | -------------- |
| work | [workScheduler.WorkInfo](js-apis-workScheduler.md#workinfo) | Yes | Task to be added to the execution queue.|
| Name | Type | Mandatory | Description |
| ---- | ---------------------------------------- | ---- | -------------- |
| work | [workScheduler.WorkInfo](js-apis-workScheduler.md#workinfo) | Yes | Target task. |
**Example**
```
```ts
export default class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility {
onWorkStop(workInfo) {
console.log('MyWorkSchedulerExtensionAbility onWorkStop' + JSON.stringify(workInfo));
......
# Work Scheduler
> **NOTE**<br/>
> 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 **workScheduler** module provides the APIs for registering, canceling, and querying Work Scheduler tasks, which do not have real-time constraints.
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
```
```js
import workScheduler from '@ohos.workScheduler'
```
......@@ -31,7 +37,7 @@ Instructs the **WorkSchedulerService** to add the specified task to the executio
**Example**
```
```js
let workInfo = {
workId: 1,
batteryLevel:50,
......@@ -67,7 +73,7 @@ Instructs the **WorkSchedulerService** to stop the specified task.
**Example**
```
```js
let workInfo = {
workId: 1,
batteryLevel:50,
......@@ -97,7 +103,7 @@ Obtains the latest task status. This API uses an asynchronous callback to return
**Example**
```
```js
workScheduler.getWorkStatus(50, (err, res) => {
if (err) {
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.
**Example**
```
```js
workScheduler.getWorkStatus(50).then((res) => {
for (let item in res) {
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
| 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**
......@@ -161,7 +167,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou
**Example**
```
```js
workScheduler.obtainAllWorks((err, res) =>{
if (err) {
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
| 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**
```
```js
workScheduler.obtainAllWorks().then((res) => {
console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res));
}).catch((err) => {
......@@ -203,7 +209,7 @@ Stops and cancels all tasks associated with the current application.
**Example**
```
```js
let res = workScheduler.stopAndClearWorks();
console.info("workschedulerLog res:" + res);
```
......@@ -230,7 +236,7 @@ Checks whether the last execution of the specified task timed out. This API uses
**Example**
```
```js
workScheduler.isLastWorkTimeOut(500, (err, res) =>{
if (err) {
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
**Example**
```
```js
workScheduler.isLastWorkTimeOut(500)
.then(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
```
## 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
| Name | Type | Mandatory| Description |
| --------------- | --------------------------------- | ---- | -------------------------------- |
| workId | number | Yes | Task ID. |
| 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.|
| networkType | [NetworkType](#networktype) | No | Network type. |
| isCharging | boolean | No | Whether the device is charging. |
| chargerType | [ChargingType](#chargingtype) | No | Charging type. |
| batteryLevel | number | No | Battery level. |
| batteryStatus | [BatteryStatus](#batterystatus) | No | Battery status. |
| storageRequest | [StorageRequest](#storagerequest) | No | Storage status. |
| isRepeat | boolean | No | Whether the task is repeated. |
| repeatCycleTime | number | No | Repeat interval. |
| repeatCount | number | No | Number of repeat times. |
| isPersisted | boolean | No | Whether to enable persistent storage for the task. |
| isDeepIdle | boolean | No | Whether the device needs to enter the idle state. |
| idleWaitTime | number | No | Time to wait in the idle state. |
| Name | Type | Mandatory | Description |
| --------------- | --------------------------------- | ---- | ---------------- |
| workId | number | Yes | Task ID. |
| 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.|
| networkType | [NetworkType](#networktype) | No | Network type. |
| isCharging | boolean | No | Whether the device is charging. |
| chargerType | [ChargingType](#chargingtype) | No | Charging type. |
| batteryLevel | number | No | Battery level. |
| batteryStatus | [BatteryStatus](#batterystatus) | No | Battery status. |
| storageRequest | [StorageRequest](#storagerequest) | No | Storage status. |
| isRepeat | boolean | No | Whether the task is repeated. |
| repeatCycleTime | number | No | Repeat interval. |
| repeatCount | number | No | Number of repeat times. |
| isPersisted | boolean | No | Whether to enable persistent storage for the task. |
| isDeepIdle | boolean | No | Whether the device needs to enter the idle state. |
| idleWaitTime | number | No | Time to wait in the idle state. |
## NetworkType
Enumerates the network types that can trigger the task.
......@@ -336,8 +342,8 @@ Enumerates the storage states that can trigger the task.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler
|Name |Default Value |Description|
| -------- | -------- | -------- |
|STORAGE_LEVEL_LOW |0 |The storage space is insufficient.
|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.
| Name | Default Value | Description |
| ------------------------- | ---- | ------------------------------ |
| STORAGE_LEVEL_LOW | 0 | The storage space is insufficient. |
| 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.|
......@@ -3,7 +3,6 @@
The **\<Image>** component is used to render and display local and online images.
> **NOTE**
>
> 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.
**Parameters**
| 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. |
| Name | Type | Mandatory | Default Value | Description |
| ---- | ---------------------------------------- | ---- | ---- | ---------------------------------------- |
| 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
In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name | Type | Default Value | Description |
| --------------------- | ---------------------------------------- | ------------------------ | ---------------------------------------- |
| alt | string \| [Resource](../../ui/ts-types.md) | - | Placeholder image displayed during loading. Both local and Internet URIs are supported. |
| objectFit | [ImageFit](#imagefit-enums) | 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. |
| 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. |
| renderMode | [ImageRenderMode](#imagerendermode) | ImageRenderMode.Original | Rendering mode of the image.<br>**NOTE**<br>This attribute is not applicable to SVG images. |
| Name | Type | Default Value | Description |
| --------------------- | ------------------------------------------------------- | ------------------------ | ------------------------------------------------------------ |
| alt | string \| [Resource](../../ui/ts-types.md#resource-type) | - | Placeholder image displayed during loading. Both local and Internet URIs are supported. |
| 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. |
| 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. |
| 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. |
### ImageFit
| 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. |
| 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. |
| None | The image is displayed in its original size. Generally, this enum is used together with the **objectRepeat** attribute.|
| ScaleDown | The image is displayed with its aspect ratio retained, in a size smaller than or equal to the original size. |
| 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.|
| 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. |
| 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. |
### ImageInterpolation
......@@ -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. |
| Template | The image is rendered as a template image, and its color is ignored.|
## Events
In addition to the universal events (ts-universal-events-click.md), the following events are supported.
......@@ -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
......@@ -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
......@@ -235,8 +235,8 @@ struct ImageExample2 {
@Entry
@Component
struct ImageExample3 {
@State width: number = 0
@State height: number = 0
@State widthValue: number = 0
@State heightValue: number = 0
private on: Resource = $r('app.media.image_on')
private off: Resource = $r('app.media.image_off')
private on2off: Resource = $r('app.media.image_on2off')
......@@ -257,8 +257,8 @@ struct ImageExample3 {
.height(180).width(180)
// Obtain the size of an image after the image loading is complete.
.onComplete((msg: { width: number,height: number }) => {
this.width = msg.width
this.height = msg.height
this.widthValue = msg.width
this.heightValue = msg.height
})
.onError(() => {
console.log('load image fail')
......@@ -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)
# AbilityComponent
**\<AbilityComponent>** is a container for independently displaying an ability.
> **NOTE**
>
> This component is supported since API version 9.
......@@ -7,8 +9,6 @@
> 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
Using **\<AbilityComponent>** requires a signature and related permissions.
......@@ -41,34 +41,20 @@ Not supported
## APIs
AbilityComponent(value: {want : Want, controller? : AbilityController})
AbilityComponent(value: {want : Want})
- Parameters
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| want | [Want](../../reference/apis/js-apis-application-Want.md) | Yes| - | Description of the default ability to load.|
| controller | [AbilityController](#abilityController) | No| - | Ability controller.|
## Events
| Name| Description|
| -------- | -------- |
| onReady()&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.|
| 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>**. |
| onConnect()&nbsp;=&gt;&nbsp;void | Called when this **\<AbilityComponent>** is started. You can then use APIs in the **\<AbilityComponent>**.|
| onDisconnect()&nbsp;=&gt;&nbsp;void | Called when this **\<AbilityComponent>** is destroyed.|
## Example
......@@ -78,7 +64,6 @@ Implements an ability controller, which provides the control APIs for **\<Abilit
@Entry
@Component
struct MyComponent {
@State controller: AbilityController = new AbilityController()
build() {
Column() {
......@@ -87,26 +72,12 @@ struct MyComponent {
bundleName: '',
abilityName: ''
},
controller: this.controller
})
.onReady(() => {
console.log('AbilityComponent ready');
})
.onDestory(() => {
console.log('AbilityComponent destory');
})
Button("Start New")
.onClick(() => {
this.controller.startAbility({
bundleName: '',
abilityName: ''
});
.onConnect(() => {
console.log('AbilityComponent connect');
})
Button("Back")
.onClick(() => {
if (this.controller.getStacjCount() > 1) {
this.controller.preformBackPress();
}
.onDisconnect(() => {
console.log('AbilityComponent disconnect');
})
}
}
......
# Column
> **NOTE**<br>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **\<Column>** component lays out child components vertically.
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
......@@ -47,7 +47,8 @@ Column(value:{space?: Length})
## Example
```
```ts
// xxx.ets
@Entry
@Component
struct ColumnExample {
......@@ -76,6 +77,7 @@ struct ColumnExample {
Column().width('30%').height(30).backgroundColor(0xAFEEEE)
Column().width('30%').height(30).backgroundColor(0x00FFFF)
}.height('15%').border({ width: 1 }).justifyContent(FlexAlign.Center)
Text('justifyContent(End)').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column() {
Column().width('30%').height(30).backgroundColor(0xAFEEEE)
......
# 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.
> **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
......@@ -25,44 +24,44 @@ Flex(options?: { direction?: FlexDirection, wrap?: FlexWrap, justifyContent?: F
Creates a standard **\<Flex>** component.
- Parameters
| 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. |
| 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. |
| 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**. |
| 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. |
| 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. |
| 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**.|
- FlexDirection enums
| Name | Description |
| -------- | -------- |
| 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. |
| 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. |
| Name | Description |
| ------------- | ---------------- |
| 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. |
| 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.|
- FlexWrap enums
| Name | Description |
| -------- | -------- |
| NoWrap | The child components in the **&lt;Flex&gt;** component are arranged in a single line, and they may overflow. |
| Wrap | The child components in the **&lt;Flex&gt;** 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. |
| Name | Description |
| ----------- | ------------------------------------------------- |
| NoWrap | The child components in the **\<Flex>** component are arranged in a single line, and they cannot overflow. |
| Wrap | The child components in the **\<Flex>** component are 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
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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.|
| 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.|
| 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. 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.|
## Example
```
// Example 01
```ts
// xxx.ets
@Entry
@Component
struct FlexExample1 {
......@@ -124,9 +123,8 @@ struct FlexExample1 {
![en-us_image_0000001256978365](figures/en-us_image_0000001256978365.gif)
```
// Example 02
```ts
// xxx.ets
@Entry
@Component
struct FlexExample2 {
......@@ -171,9 +169,8 @@ struct FlexExample2 {
![en-us_image_0000001211898500](figures/en-us_image_0000001211898500.png)
```
// Example 03
```ts
// xxx.ets
@Component
struct JustifyContentFlex {
@Prop justifyContent : number
......@@ -221,9 +218,8 @@ struct FlexExample3 {
![en-us_image_0000001212218462](figures/en-us_image_0000001212218462.gif)
```
// Example 04
```ts
// xxx.ets
@Component
struct AlignItemsFlex {
@Prop alignItems : number
......@@ -273,9 +269,8 @@ struct FlexExample4 {
![en-us_image_0000001212378426](figures/en-us_image_0000001212378426.gif)
```
// Example 05
```ts
// xxx.ets
@Component
struct AlignContentFlex {
@Prop alignContent: number
......
# 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.
The **<Swiper\>** component provides a container that allows users to switch among child components through swiping.
## Required Permissions
None
......@@ -23,49 +22,94 @@ This component can contain child components.
Swiper(value:{controller?: SwiperController})
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| controller | [SwiperController](#swipercontroller) | No | null | Controller bound to the component to control the page switching. |
**Parameters**
| 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 |
| -------- | -------- | -------- | -------- |
| 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. |
## Attributes
[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
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 |
| -------- | -------- |
| showNext():void | Turns to the next page. |
| showPrevious():void | Turns to the previous page. |
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
| Name | Description |
| -------- | -------- |
| onChange( index: number) =&gt; void | Triggered when the index of the currently displayed component changes. |
### onChange
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
// xxx.ets
......@@ -123,7 +167,7 @@ struct SwiperExample {
.duration(1000)
.vertical(false) // Horizontal swiping is enabled by default.
.itemSpace(0)
.curve(Curve.Linear) // Animation curve
.curve(Curve.Linear) // Animation curve.
.onChange((index: number) => {
console.info(index.toString())
})
......
# 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.
> **NOTE**
>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Required Permissions
......@@ -87,7 +87,8 @@ Switches to the specified tab.
## Example
```
```ts
// xxx.ets
@Entry
@Component
struct TabsExample {
......
......@@ -273,7 +273,7 @@ struct MiterLimit {
// xxx.ets
@Entry
@Component
struct Font {
struct Fonts {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
......@@ -728,7 +728,7 @@ Fills a rectangle on the canvas.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct FillRect {
......@@ -773,7 +773,8 @@ Draws an outlined rectangle on the canvas.
- Example
```
```ts
// xxx.ets
@Entry
@Component
struct StrokeRect {
......@@ -818,7 +819,7 @@ Clears the content in a rectangle on the canvas.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct ClearRect {
......@@ -864,7 +865,7 @@ Draws filled text on the canvas.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct FillText {
......@@ -908,7 +909,8 @@ Draws a text stroke on the canvas.
- Example
```
```ts
// xxx.ets
@Entry
@Component
struct StrokeText {
......@@ -961,7 +963,7 @@ Returns a **TextMetrics** object used to obtain the width of specified text.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct MeasureText {
......@@ -1004,7 +1006,8 @@ Strokes a path.
- Example
```
```ts
// xxx.ets
@Entry
@Component
struct Stroke {
......@@ -1044,7 +1047,7 @@ Creates a drawing path.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct BeginPath {
......@@ -1092,7 +1095,7 @@ Moves a drawing path to a target position on the canvas.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct MoveTo {
......@@ -1138,7 +1141,7 @@ Connects the current point to a target position using a straight line.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct LineTo {
......@@ -1178,7 +1181,7 @@ Draws a closed path.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct ClosePath {
......@@ -1226,7 +1229,7 @@ Creates a pattern for image filling based on a specified source image and repeti
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct CreatePattern {
......@@ -1276,7 +1279,7 @@ Draws a cubic bezier curve on the canvas.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct BezierCurveTo {
......@@ -1324,7 +1327,7 @@ Draws a quadratic curve on the canvas.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct QuadraticCurveTo {
......@@ -1374,7 +1377,7 @@ Draws an arc on the canvas.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct Arc {
......@@ -1422,7 +1425,7 @@ Draws an arc based on the radius and points on the arc.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct ArcTo {
......@@ -1474,7 +1477,7 @@ Draws an ellipse in the specified rectangular region.
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct CanvasExample {
......@@ -1521,7 +1524,7 @@ Creates a rectangle.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct CanvasExample {
......@@ -1559,7 +1562,7 @@ Fills the area inside a closed path.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct Fill {
......@@ -1597,7 +1600,7 @@ Sets the current path to a clipping path.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct Clip {
......@@ -1643,7 +1646,7 @@ Rotates a canvas clockwise around its coordinate axes.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct Rotate {
......@@ -1687,7 +1690,7 @@ Scales a canvas based on scale factors.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct Scale {
......@@ -1743,7 +1746,7 @@ Defines a transformation matrix. To transform a graph, you only need to set para
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct Transform {
......@@ -1797,7 +1800,7 @@ Resets the existing transformation matrix and creates a new transformation matri
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct SetTransform {
......@@ -1844,7 +1847,7 @@ Moves the origin of the coordinate system.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct Translate {
......@@ -1901,7 +1904,7 @@ Draws an image.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct Index {
......@@ -2002,7 +2005,7 @@ Puts the [ImageData](ts-components-canvas-imagebitmap.md) onto a rectangular are
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct PutImageData {
......@@ -2046,7 +2049,7 @@ Restores the saved drawing context.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct CanvasExample {
......@@ -2081,7 +2084,7 @@ Saves the current drawing context.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct CanvasExample {
......@@ -2124,7 +2127,7 @@ Creates a linear gradient.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct CreateLinearGradient {
......@@ -2177,7 +2180,7 @@ Creates a linear gradient.
- Example
```ts
// xxx.ets
// xxx.ets
@Entry
@Component
struct CreateRadialGradient {
......
# Visibility
The visibility attribute controls whether a component is visible.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
> **NOTE**
>
> This event is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Required Permissions
......@@ -13,23 +15,23 @@ None
## 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
| Name | Description |
| Name| Description|
| -------- | -------- |
| Hidden | The component is hidden, and a placeholder is used for it in the layout. |
| Visible | The component is shown. |
| None | The component is hidden. It is not involved in the layout, and no placeholder is used for it. |
| Hidden | The component is hidden, and a placeholder is used for it in the layout.|
| Visible | The component is visible.|
| None | The component is hidden. It is not involved in the layout, and no placeholder is used for it.|
## Example
```
```ts
// xxx.ets
@Entry
@Component
struct VisibilityExample {
......@@ -40,11 +42,11 @@ struct VisibilityExample {
Row().visibility(Visibility.Visible).width('90%').height(80).backgroundColor(0xAFEEEE)
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)
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)
}.width('90%').border({ width: 1 })
}.width('100%').margin({ top: 5 })
......
......@@ -15,7 +15,7 @@ None
| 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
......@@ -41,8 +41,8 @@ None
| -------- | -------- | -------- |
| width | number | Width of the target element, in vp. |
| height | number | Height of the target element, in vp. |
| position | [Position](#position8) | Position of the upper left corner of the target element relative to that of the parent element. |
| globalPosition | [Position](#position8) | Position of the upper left corner of the target element relative to that of the page. |
| position | Position | Position of the upper left corner of the target element relative to that of the parent element. |
| globalPosition | Position | Position of the upper left corner of the target element relative to that of the page. |
## Position<sup>8+</sup>
......
......@@ -22,15 +22,15 @@ None
## KeyEvent
- Attributes
| Name | Type | Description |
| -------- | -------- | -------- |
| type | [KeyType](#keytype-enums) | Type of a key. |
| keyCode | number | Key code. |
| keyText | string | Key value. |
| keySource | [KeySource](#keysource-enums) | Type of the input device that triggers the key event. |
| deviceId | number | ID of the input device that triggers the key event. |
| metaKey | number | State of the metakey when the key is pressed. The value **1** means the pressed state, and **0** means the unpressed state. |
| timestamp | number | Timestamp when the key is pressed. |
| Name | Type | Description |
| ------------------------------------- | --------------------------- | -------------------------- |
| type | [KeyType](#keytype-enums) | Type of a key. |
| [keyCode](../apis/js-apis-keycode.md) | number | Key code. |
| keyText | string | Key value. |
| keySource | [KeySource](#keysource-enums) | Type of the input device that triggers the key event. |
| deviceId | number | ID of the input device that triggers the key event. |
| metaKey | number | State of the metakey when the key is pressed. The value **1** means the pressed state, and **0** means the unpressed state. |
| timestamp | number | Timestamp when the key is pressed. |
- APIs
| Name | Description |
......@@ -48,20 +48,10 @@ None
## KeySource Enums
| Name | Description |
| -------- | -------- |
| Unknown | Unknown input device. |
| [KeyCode](#common-keycode-enums) | The input device is a keyboard. |
| Unknown | Unknown input device. |
| 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
......
......@@ -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.
- 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.
- 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 |
| -------- | -------- | -------- | -------- |
| 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 |
| 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
......
......@@ -52,6 +52,7 @@
- [Introduction to the Hi3861 Development Board](quick-start/quickstart-lite-introduction-hi3861.md)
- [Introduction to the Hi3516 Development Board](quick-start/quickstart-lite-introduction-hi3516.md)
- [Reference](quick-start/quickstart-lite-reference.md)
- [Burning Code by Using HiTool](quick-start/quickstart-lite-hitool.md)
- [Overall Description of Compilation Form Factors](quick-start/quickstart-build.md)
- Getting Started with Standard System (IDE Mode, Recommended)
- [Standard System Overview](quick-start/quickstart-ide-standard-overview.md)
......@@ -97,10 +98,11 @@
- [Introduction to the Hi3516 Development Board](quick-start/quickstart-standard-board-introduction-hi3516.md)
- [Introduction to the RK3568 Development Board](quick-start/quickstart-standard-board-introduction-rk3568.md)
- [Reference](quick-start/quickstart-standard-reference.md)
- [Burning Code by Using HiTool](quick-start/quickstart-standard-hitool.md)
- [Overall Description of Compilation Form Factors](quick-start/quickstart-build.md)
- [Obtaining Source Code](get-code/sourcecode-acquire.md)
- [Obtaining Source Code](get-code/sourcecode-acquire.md)
- Compatibility and Security
- [Privacy Protection](security/security-privacy-protection.md)
......@@ -399,6 +401,7 @@
- [Building the Standard System](subsystems/subsys-build-standard-large.md)
- [Build System Coding Specifications and Best Practices](subsystems/subsys-build-gn-coding-style-and-best-practice.md)
- [Building the Kconfig Visual Configuration](subsystems/subsys-build-gn-kconfig-visual-config-guide.md)
- [HAP Build Guide](subsystems/subsys-build-gn-hap-compilation-guide.md)
- [Distributed Remote Startup](subsystems/subsys-remote-start.md)
- Graphics
- [Graphics Overview](subsystems/subsys-graphics-overview.md)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册