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

!20457 【3.2-Release】翻译完成 19938

Merge pull request !20457 from ester.zhou/C2-19938
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
- Application Configuration Files in FA Model - Application Configuration Files in FA Model
- [Application Configuration File Overview (FA Model)](application-configuration-file-overview-fa.md) - [Application Configuration File Overview (FA Model)](application-configuration-file-overview-fa.md)
- [Internal Structure of the app Tag](app-structure.md) - [Internal Structure of the app Tag](app-structure.md)
- [Internal Structure of deviceConfig Tag](deviceconfig-structure.md) - [Internal Structure of the deviceConfig Tag](deviceconfig-structure.md)
- [Internal Structure of the module Tag](module-structure.md) - [Internal Structure of the module Tag](module-structure.md)
- [Resource Categories and Access](resource-categories-and-access.md) - [Resource Categories and Access](resource-categories-and-access.md)
- Learning ArkTS - Learning ArkTS
...@@ -45,19 +45,19 @@ ...@@ -45,19 +45,19 @@
- Custom Component - Custom Component
- [Creating a Custom Component](arkts-create-custom-components.md) - [Creating a Custom Component](arkts-create-custom-components.md)
- [Page and Custom Component Lifecycle](arkts-page-custom-components-lifecycle.md) - [Page and Custom Component Lifecycle](arkts-page-custom-components-lifecycle.md)
- [\@Builder: Custom Builder Function](arkts-builder.md) - [\@Builder Decorator: Custom Builder Function](arkts-builder.md)
- [\@BuilderParam: @Builder Function Reference](arkts-builderparam.md) - [\@BuilderParam Decorator: @Builder Function Reference](arkts-builderparam.md)
- [\@Styles: Definition of Resusable Styles](arkts-style.md) - [\@Styles Decorator: Definition of Resusable Styles](arkts-style.md)
- [\@Extend: Extension of Built-in Components](arkts-extend.md) - [\@Extend Decorator: Extension of Built-in Components](arkts-extend.md)
- [stateStyles: Polymorphic Style](arkts-statestyles.md) - [stateStyles Decorator: Polymorphic Style](arkts-statestyles.md)
- State Management - State Management
- [State Management Overview](arkts-state-management-overview.md) - [State Management Overview](arkts-state-management-overview.md)
- Component State Management - Component State Management
- [\@State: State Owned by Component](arkts-state.md) - [\@State Decorator: State Owned by Component](arkts-state.md)
- [\@Prop: One-Way Synchronization from Parent to Child Components](arkts-prop.md) - [\@Prop Decorator: One-Way Synchronization from Parent to Child Components](arkts-prop.md)
- [\@Link: Two-Way Synchronization Between Parent and Child Components](arkts-link.md) - [\@Link Decorator: Two-Way Synchronization Between Parent and Child Components](arkts-link.md)
- [\@Provide and \@Consume: Two-Way Synchronization with Descendant Components](arkts-provide-and-consume.md) - [\@Provide and \@Consume Decorators: Two-Way Synchronization with Descendant Components](arkts-provide-and-consume.md)
- [\@Observed and \@ObjectLink: Observing Attribute Changes in Nested Class Objects](arkts-observed-and-objectlink.md) - [\@Observed and \@ObjectLink Decorators: Observing Attribute Changes in Nested Class Objects](arkts-observed-and-objectlink.md)
- Application State Management - Application State Management
- [Application State Management Overview](arkts-application-state-management-overview.md) - [Application State Management Overview](arkts-application-state-management-overview.md)
- [LocalStorage: UI State Storage](arkts-localstorage.md) - [LocalStorage: UI State Storage](arkts-localstorage.md)
......
# \@Builder: Custom Builder Function # \@Builder Decorator: Custom Builder Function
After a custom component is created, its internal UI structure is fixed and allows only data passing with its caller. ArkUI also provides a more lightweight mechanism for reusing UI elements: \@Builder. An \@Builder decorated function is a special function that serves similar purpose as the build function. The \@Builder function body follows the same syntax rules as the **build** function. You can abstract reusable UI elements into a method and call the method in **build**. As previously described, you can reuse UI elements by creating a custom component, which comes with a fixed internal UI structure and allows for data transfer only with its caller. ArkUI also provides a more lightweight mechanism for reusing UI elements: \@Builder. An \@Builder decorated function is a special function that serves similar purpose as the build function. The \@Builder function body follows the same syntax rules as the **build** function. You can abstract reusable UI elements into a method and call the method in **build**.
To simplify language, here we refer to an \@Builder decorated function also as a custom builder function. To simplify language, here we refer to an \@Builder decorated function also as a custom builder function.
...@@ -33,7 +33,7 @@ this.myBuilderFunction({ ... }) ...@@ -33,7 +33,7 @@ this.myBuilderFunction({ ... })
- Defining one or more custom builder (\@Builder decorated) functions inside a custom component is allowed. Such a custom builder function can be considered as a private, special type of member functions of that component. - Defining one or more custom builder (\@Builder decorated) functions inside a custom component is allowed. Such a custom builder function can be considered as a private, special type of member functions of that component.
- The custom builder function can be called from the owning component's** build** or another custom builder (within that custom component) function only. - The custom builder function can be called from the owning component's **build** or another custom builder (within that custom component) function only.
- Inside the custom builder function body, **this** refers to the owning component. Component state variables are accessible from within the custom builder function implementation. Using the custom components' state variables is recommended over parameter passing. - Inside the custom builder function body, **this** refers to the owning component. Component state variables are accessible from within the custom builder function implementation. Using the custom components' state variables is recommended over parameter passing.
......
# \@BuilderParam: @Builder Function Reference # \@BuilderParam Decorator: @Builder Function Reference
In certain circumstances, you may need to add a specific function, such as a click-to-jump action, to a custom component. However, embedding an event method directly inside of the component will add the function to all places where the component is imported. This is where the \@BuilderParam decorator comes into the picture. \@BuilderParam is used to decorate a custom component member variable of type reference to an \@Builder method. When initializing a custom component, you can assign a value to the variable, thereby adding the specific function to the custom component. This decorator can be used to declare an element of any UI description, similar to a slot placeholder. In certain circumstances, you may need to add a specific function, such as a click-to-jump action, to a custom component. However, embedding an event method directly inside of the component will add the function to all places where the component is imported. This is where the \@BuilderParam decorator comes into the picture. \@BuilderParam is used to decorate a custom component member variable of type reference to an \@Builder method. When initializing a custom component, you can assign a value to the variable, thereby adding the specific function to the custom component. This decorator can be used to declare an element of any UI description, similar to a slot placeholder.
......
# \@Extend: Extension of Built-in Components # \@Extend Decorator: Extension of Built-in Components
Apart from\@Styles used to extend styles, AkrUI also provides \@Extend, which allows you to add a new attribute feature to a built-in component. Apart from\@Styles used to extend styles, AkrUI also provides \@Extend, which allows you to add a new attribute feature to a built-in component.
......
# \@Link: Two-Way Synchronization Between Parent and Child Components # \@Link Decorator: Two-Way Synchronization Between Parent and Child Components
An \@Link decorated variable can create two-way synchronization with a variable of its parent component. An \@Link decorated variable can create two-way synchronization with a variable of its parent component.
...@@ -184,3 +184,4 @@ struct Parent { ...@@ -184,3 +184,4 @@ struct Parent {
As described above, the ArkUI framework can observe the addition, deletion, and replacement of array items. It should be noted that, in the preceding example, the type of the \@Link and \@State decorated variables is the same: number[]. It is not allowed to define the \@Link decorated variable in the child component as type number (**\@Link item: number**), and create child components for each array item in the \@State decorated array in the parent component. [\@Prop](arkts-prop.md) or \@Observed should be used depending on application semantics. As described above, the ArkUI framework can observe the addition, deletion, and replacement of array items. It should be noted that, in the preceding example, the type of the \@Link and \@State decorated variables is the same: number[]. It is not allowed to define the \@Link decorated variable in the child component as type number (**\@Link item: number**), and create child components for each array item in the \@State decorated array in the parent component. [\@Prop](arkts-prop.md) or \@Observed should be used depending on application semantics.
<!--no_check-->
# \@Observed and \@ObjectLink: Observing Attribute Changes in Nested Class Objects # \@Observed and \@ObjectLink Decorators: Observing Attribute Changes in Nested Class Objects
The decorators described above can observe only the changes of the first layer. However, in real-world application development, the application may encapsulate its own data model based on development requirements. In the case of multi-layer nesting, for example, a two-dimensional array, an array item class, or a class insider another class as an attribute, the attribute changes at the second layer cannot be observed. This is where the \@Observed and \@ObjectLink decorators come in handy. The decorators described above can observe only the changes of the first layer. However, in real-world application development, the application may encapsulate its own data model based on development requirements. In the case of multi-layer nesting, for example, a two-dimensional array, an array item class, or a class insider another class as an attribute, the attribute changes at the second layer cannot be observed. This is where the \@Observed and \@ObjectLink decorators come in handy.
......
# \@Prop: One-Way Synchronization from Parent to Child Components # \@Prop Decorator: One-Way Synchronization from Parent to Child Components
An \@Prop decorated variable can create one-way synchronization with a variable of its parent component. \@Prop decorated variables are mutable, but changes are not synchronized to the parent component. An \@Prop decorated variable can create one-way synchronization with a variable of its parent component. \@Prop decorated variables are mutable, but changes are not synchronized to the parent component.
...@@ -302,7 +302,7 @@ To enable an \@Component decorated component to be reusable, \@Prop allows for o ...@@ -302,7 +302,7 @@ To enable an \@Component decorated component to be reusable, \@Prop allows for o
The following example includes two @Prop decorated variables in child component. The following example includes two @Prop decorated variables in child component.
- The @Prop decorated variable **customCounter** has no local initialization, and therefore it requires a synchronization source in its parent component. When the source value changes, the @Prop decorated variable is udpated. - The @Prop decorated variable **customCounter** has no local initialization, and therefore it requires a synchronization source in its parent component. When the source value changes, the @Prop decorated variable is updated.
- The @Prop decorated variable **customCounter2** has local initialization. In this case, specifying a synchronization source in the parent component is allowed but not mandatory. - The @Prop decorated variable **customCounter2** has local initialization. In this case, specifying a synchronization source in the parent component is allowed but not mandatory.
...@@ -360,3 +360,4 @@ struct MainProgram { ...@@ -360,3 +360,4 @@ struct MainProgram {
} }
} }
``` ```
<!--no_check-->
# \@Provide and \@Consume: Two-Way Synchronization with Descendant Components # \@Provide and \@Consume Decorators: Two-Way Synchronization with Descendant Components
\@Provide and \@Consume are used for two-way data synchronization with descendant components in scenarios where state data needs to be transferred between multiple levels. They do not involve passing a variable from component to component multiple times. \@Provide and \@Consume are used for two-way data synchronization with descendant components in scenarios where state data needs to be transferred between multiple levels. They do not involve passing a variable from component to component multiple times.
......
# \@State: State Owned by Component # \@State Decorator: State Owned by Component
An \@State decorated variable, also called a state variable, is a variable that holds the state property and is used to render the owning custom component. When it changes, the UI is re-rendered accordingly. An \@State decorated variable, also called a state variable, is a variable that holds the state property and is used to render the owning custom component. When it changes, the UI is re-rendered accordingly.
......
# stateStyles: Polymorphic Style # stateStyles Decorator: Polymorphic Style
Unlike \@Styles and \@Extend, which are used to reuse styles only on static pages, stateStyles enables you to set state-specific styles. Unlike \@Styles and \@Extend, which are used to reuse styles only on static pages, stateStyles enables you to set state-specific styles.
......
# \@Styles: Definition of Resusable Styles # \@Styles Decorator: Definition of Resusable Styles
If the style of each component needs to be set separately, this will result in a large amount of repeated code during development. Though copy and paste is available, it is inefficient and error-prone. To maximize code efficiency and maintainability, the \@Styles decorator is introduced. If the style of each component needs to be set separately, this will result in a large amount of repeated code during development. Though copy and paste is available, it is inefficient and error-prone. To maximize code efficiency and maintainability, the \@Styles decorator is introduced.
......
# Internal structure of deviceConfig Tag # Internal Structure of the deviceConfig Tag
The **deviceConfig** tag contains device-specific configuration of the application, including attributes such as **default**, **tv**, **car**, and **wearable**. The **default** configuration applies to all types of devices. You need to declare the peculiar configuration of a specific device type in the associated sub-tag of this type. The **deviceConfig** tag contains device-specific configuration of the application, including attributes such as **default**, **tv**, **car**, and **wearable**. The **default** configuration applies to all types of devices. You need to declare the peculiar configuration of a specific device type in the associated sub-tag of this type.
......
...@@ -6,39 +6,39 @@ ...@@ -6,39 +6,39 @@
- Layout Development - Layout Development
- [Layout Overview](arkts-layout-development-overview.md) - [Layout Overview](arkts-layout-development-overview.md)
- Building a Layout - Building a Layout
- [Linear Layout](arkts-layout-development-linear.md) - [Linear Layout (Row/Column)](arkts-layout-development-linear.md)
- [Stack Layout](arkts-layout-development-stack-layout.md) - [Stack Layout (Stack)](arkts-layout-development-stack-layout.md)
- [Flex Layout](arkts-layout-development-flex-layout.md) - [Flex Layout (Flex)](arkts-layout-development-flex-layout.md)
- [Relative Layout](arkts-layout-development-relative-layout.md) - [Relative Layout (RelativeContainer)](arkts-layout-development-relative-layout.md)
- [Responsive Grid Layout](arkts-layout-development-grid-layout.md) - [Responsive Grid Layout (GridRow/GridCol)](arkts-layout-development-grid-layout.md)
- [Media Query](arkts-layout-development-media-query.md) - [Media Query (mediaquery)](arkts-layout-development-media-query.md)
- [Creating a List](arkts-layout-development-create-list.md) - [Creating a List (List)](arkts-layout-development-create-list.md)
- [Creating a Grid](arkts-layout-development-create-grid.md) - [Creating a Grid (Grid/GridItem)](arkts-layout-development-create-grid.md)
- [Creating a Swiper](arkts-layout-development-create-looping.md) - [Creating a Swiper (Swiper)](arkts-layout-development-create-looping.md)
- [Improving Layout Performance](arkts-layout-development-performance-boost.md) - [Improving Layout Performance](arkts-layout-development-performance-boost.md)
- Adding a Component - Adding a Component
- Adding a Common Component - Adding a Common Component
- [Button](arkts-common-components-button.md) - [Button](arkts-common-components-button.md)
- [Radio Button](arkts-common-components-radio-button.md) - [Radio Button (Radio)](arkts-common-components-radio-button.md)
- [Toggle](arkts-common-components-switch.md) - [Toggle](arkts-common-components-switch.md)
- [Progress Indicator](arkts-common-components-progress-indicator.md) - [Progress Indicator (Progress)](arkts-common-components-progress-indicator.md)
- [Text Display](arkts-common-components-text-display.md) - [Text Display (Text/Span)](arkts-common-components-text-display.md)
- [Text Input](arkts-common-components-text-input.md) - [Text Input (TextInput/TextArea)](arkts-common-components-text-input.md)
- [Custom Dialog Box](arkts-common-components-custom-dialog.md) - [Custom Dialog Box (CustomDialog)](arkts-common-components-custom-dialog.md)
- [Video Playback](arkts-common-components-video-player.md) - [Video Playback (Video](arkts-common-components-video-player.md)
- [XComponent](arkts-common-components-xcomponent.md) - [XComponent](arkts-common-components-xcomponent.md)
- Adding a Bubble and Menu - Adding a Popup and Menu
- [Bubble](arkts-popup-and-menu-components-popup.md) - [Popup](arkts-popup-and-menu-components-popup.md)
- [Menu](arkts-popup-and-menu-components-menu.md) - [Menu](arkts-popup-and-menu-components-menu.md)
- Setting Page Routing and Component Navigation - Setting Page Routing and Component Navigation
- [Page Routing](arkts-routing.md) - [Page Routing (router)](arkts-routing.md)
- Component Navigation - Component Navigation
- [Navigation](arkts-navigation-navigation.md) - [Navigation](arkts-navigation-navigation.md)
- [Tabs](arkts-navigation-tabs.md) - [Tabs](arkts-navigation-tabs.md)
- Using Graphics - Using Graphics
- [Displaying Images](arkts-graphics-display.md) - [Displaying Images (Image)](arkts-graphics-display.md)
- [Drawing Geometric Shapes](arkts-geometric-shape-drawing.md) - [Drawing Geometric Shapes (Shape)](arkts-geometric-shape-drawing.md)
- [Drawing Custom Graphics on the Canvas](arkts-drawing-customization-on-canvas.md) - [Drawing Custom Graphics on the Canvas (Canvas)](arkts-drawing-customization-on-canvas.md)
- Using Animation - Using Animation
- [Animation Overview](arkts-animation-overview.md) - [Animation Overview](arkts-animation-overview.md)
- Animation Within a Page - Animation Within a Page
......
...@@ -54,33 +54,36 @@ Use the **type** parameter to set the button type to **Capsule**, **Circle**, or ...@@ -54,33 +54,36 @@ Use the **type** parameter to set the button type to **Capsule**, **Circle**, or
- Capsule button (default type) - Capsule button (default type)
Buttons of this type have rounded corners whose radius is automatically set to half of the button height. The rounded corners cannot be reset through the **borderRadius** attribute. Buttons of this type have rounded corners whose radius is automatically set to half of the button height. The rounded corners cannot be reset through the **borderRadius** attribute.
```ts ```ts
Button('Disable', { type: ButtonType.Capsule, stateEffect: false }) Button('Disable', { type: ButtonType.Capsule, stateEffect: false })
.backgroundColor(0x317aff) .backgroundColor(0x317aff)
.width(90) .width(90)
.height(40) .height(40)
``` ```
![en-us_image_0000001511421208](figures/en-us_image_0000001511421208.png) ![en-us_image_0000001511421208](figures/en-us_image_0000001511421208.png)
- Circle button - Circle button
Buttons of this type are round. The rounded corners cannot be reset through the **borderRadius** attribute. Buttons of this type are round. The rounded corners cannot be reset through the **borderRadius** attribute.
```ts ```ts
Button('Circle', { type: ButtonType.Circle, stateEffect: false }) Button('Circle', { type: ButtonType.Circle, stateEffect: false })
.backgroundColor(0x317aff) .backgroundColor(0x317aff)
.width(90) .width(90)
.height(90) .height(90)
``` ```
![en-us_image_0000001511740428](figures/en-us_image_0000001511740428.png) ![en-us_image_0000001511740428](figures/en-us_image_0000001511740428.png)
- Normal button - Normal button
Buttons of this type have rounded corners set to 0. The rounded corners can be reset through the **borderRadius** attribute. Buttons of this type have rounded corners set to 0. The rounded corners can be reset through the **borderRadius** attribute.
```ts ```ts
Button('Ok', { type: ButtonType.Normal, stateEffect: true }) Button('Ok', { type: ButtonType.Normal, stateEffect: true })
.borderRadius(8) .borderRadius(8)
...@@ -88,40 +91,43 @@ Use the **type** parameter to set the button type to **Capsule**, **Circle**, or ...@@ -88,40 +91,43 @@ Use the **type** parameter to set the button type to **Capsule**, **Circle**, or
.width(90) .width(90)
.height(40) .height(40)
``` ```
![en-us_image_0000001563060641](figures/en-us_image_0000001563060641.png) ![en-us_image_0000001563060641](figures/en-us_image_0000001563060641.png)
## Setting Styles ## Setting Styles
- Set the border radius: - Set the border radius.
In general cases, you can use universal attributes to define the button styles. For example, you can use the **borderRadius** attribute to set the border radius. In general cases, you can use universal attributes to define the button styles. For example, you can use the **borderRadius** attribute to set the border radius.
```ts ```ts
Button('circle border', { type: ButtonType.Normal }) Button('circle border', { type: ButtonType.Normal })
.borderRadius(20) .borderRadius(20)
.height(40) .height(40)
``` ```
![en-us_image_0000001511900392](figures/en-us_image_0000001511900392.png) ![en-us_image_0000001511900392](figures/en-us_image_0000001511900392.png)
- The **Font** type is used to set the text style. - Set the text style.
Add a font style for text displayed on the button.
Add text style attributes for the button.
```ts ```ts
Button('font style', { type: ButtonType.Normal }) Button('font style', { type: ButtonType.Normal })
.fontSize(20) .fontSize(20)
.fontColor(Color.Pink) .fontColor(Color.Pink)
.fontWeight(800) .fontWeight(800)
``` ```
![en-us_image_0000001511580828](figures/en-us_image_0000001511580828.png) ![en-us_image_0000001511580828](figures/en-us_image_0000001511580828.png)
- Set the background color: - Set the background color.
You can do so by adding the **backgroundColor** attribute.
Add the **backgroundColor** attribute for the button.
```ts ```ts
Button('background color').backgroundColor(0xF55A42) Button('background color').backgroundColor(0xF55A42)
``` ```
...@@ -129,15 +135,16 @@ Use the **type** parameter to set the button type to **Capsule**, **Circle**, or ...@@ -129,15 +135,16 @@ Use the **type** parameter to set the button type to **Capsule**, **Circle**, or
![en-us_image_0000001562940477](figures/en-us_image_0000001562940477.png) ![en-us_image_0000001562940477](figures/en-us_image_0000001562940477.png)
- Assign a function to the button: - Assign a function to the button.
In this example, the delete function is assigned to the button. In this example, the delete function is assigned to the button.
```ts ```ts
Button({ type: ButtonType.Circle, stateEffect: true }) { Button({ type: ButtonType.Circle, stateEffect: true }) {
Image($r('app.media.ic_public_delete_filled')).width(30).height(30) Image($r('app.media.ic_public_delete_filled')).width(30).height(30)
}.width(55).height(55).margin({ left: 20 }).backgroundColor(0xF55A42) }.width(55).height(55).margin({ left: 20 }).backgroundColor(0xF55A42)
``` ```
![en-us_image_0000001511740436](figures/en-us_image_0000001511740436.png) ![en-us_image_0000001511740436](figures/en-us_image_0000001511740436.png)
...@@ -153,9 +160,10 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true }) ...@@ -153,9 +160,10 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true })
``` ```
## Example Scenario ## Example
- Using the button for startup
- Using the Button for Startup
You can use the button for any UI element that involves the startup operation. The button triggers the predefined event based on the user's operation. For example, you can use a button in the **\<List>** container to redirect the user to another page. You can use the button for any UI element that involves the startup operation. The button triggers the predefined event based on the user's operation. For example, you can use a button in the **\<List>** container to redirect the user to another page.
```ts ```ts
...@@ -194,7 +202,8 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true }) ...@@ -194,7 +202,8 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true })
![en-us_image_0000001562700393](figures/en-us_image_0000001562700393.png) ![en-us_image_0000001562700393](figures/en-us_image_0000001562700393.png)
- Use the button for submitting forms: - Using the button for submitting forms
On the user login/registration page, you can use a button to submit a login or registration request. On the user login/registration page, you can use a button to submit a login or registration request.
```ts ```ts
...@@ -217,7 +226,8 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true }) ...@@ -217,7 +226,8 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true })
![en-us_image_0000001562940473](figures/en-us_image_0000001562940473.png) ![en-us_image_0000001562940473](figures/en-us_image_0000001562940473.png)
- Configure the button to float: - Configuring the button to float
The button can remain floating when the user swipes on the screen. The button can remain floating when the user swipes on the screen.
```ts ```ts
......
# Custom Dialog Box # Custom Dialog Box (CustomDialog)
A custom dialog box is a dialog box you customize by using APIs of the **CustomDialogController** class. It can be used for user interactions, showing an ad, prize, alert, software update message, and more. For details, see [Custom Dialog Box](../reference/arkui-ts/ts-methods-custom-dialog-box.md). A custom dialog box is a dialog box you customize by using APIs of the **CustomDialogController** class. It can be used for user interactions, showing an ad, prize, alert, software update message, and more. For details, see [Custom Dialog Box](../reference/arkui-ts/ts-methods-custom-dialog-box.md).
......
# Progress Indicator # Progress Indicator (Progress)
The **\<Progress>** component is used to provide a progress indicator that displays the progress of an operation. For details, see [Progress](../reference/arkui-ts/ts-basic-components-progress.md). The **\<Progress>** component is used to provide a progress indicator that displays the progress of an operation. For details, see [Progress](../reference/arkui-ts/ts-basic-components-progress.md).
......
# Radio Button # Radio Button (Radio)
The **\<Radio>** component allows users to select from a set of mutually exclusive options. Only one radio button in a given group can be selected at the same time. For details, see [Radio](../reference/arkui-ts/ts-basic-components-radio.md). The **\<Radio>** component allows users to select from a set of mutually exclusive options. Only one radio button in a given group can be selected at the same time. For details, see [Radio](../reference/arkui-ts/ts-basic-components-radio.md).
......
# Text Display # Text Display (Text/Span)
The **\<Text>** component is used to display a piece of textual information. For details, see [Text](../reference/arkui-ts/ts-basic-components-text.md). The **\<Text>** component is used to display a piece of textual information. For details, see [Text](../reference/arkui-ts/ts-basic-components-text.md).
......
# Text Input # Text Input (TextInput/TextArea)
The **\<TextInput>** and **\<TextArea>** components are input components typically used to accept input from the user, such as comments, chat messages, and table content. They can be used in combination with other components to meet more diversified purposes, for example, login and registration. For details, see [TextInput](../reference/arkui-ts/ts-basic-components-textinput.md) and [TextArea](../reference/arkui-ts/ts-basic-components-textarea.md). The **\<TextInput>** and **\<TextArea>** components are input components typically used to accept input from the user, such as comments, chat messages, and table content. They can be used in combination with other components to meet more diversified purposes, for example, login and registration. For details, see [TextInput](../reference/arkui-ts/ts-basic-components-textinput.md) and [TextArea](../reference/arkui-ts/ts-basic-components-textarea.md).
......
# Drawing Custom Graphics Using the Canvas # Drawing Custom Graphics Using the Canvas (Canvas)
**Canvas** provides a canvas component for drawing custom graphics. You can use the **CanvasRenderingContext2D** and **OffscreenCanvasRenderingContext2D** objects to draw graphics on the **Canvas** component. The drawing objects can be basic shapes, text, and images. **Canvas** provides a canvas component for drawing custom graphics. You can use the **CanvasRenderingContext2D** and **OffscreenCanvasRenderingContext2D** objects to draw graphics on the **Canvas** component. The drawing objects can be basic shapes, text, and images.
......
# Drawing Geometric Shapes # Drawing Geometric Shapes (Shape)
The drawing components are used to draw graphs on the page. The **\<Shape>** component is the parent component of the drawing components. The attributes of **\<Shape>** are universal attributes supported by all the drawing components. For details, see [Shape](../reference/arkui-ts/ts-drawing-components-shape.md). The drawing components are used to draw graphs on the page. The **\<Shape>** component is the parent component of the drawing components. The attributes of **\<Shape>** are universal attributes supported by all the drawing components. For details, see [Shape](../reference/arkui-ts/ts-drawing-components-shape.md).
......
# Displaying Images # Displaying Images (Image)
More often than not, you may need to display images in your application, for example, logos in buttons, online images, and local images. To do so, you need to use the **\<Image>** component, which supports a wide range of image formats, including PNG, JPG, BMP, SVG, and GIF. For details, see [Image](../reference/arkui-ts/ts-basic-components-image.md). More often than not, you may need to display images in your application, for example, logos in buttons, online images, and local images. To do so, you need to use the **\<Image>** component, which supports a wide range of image formats, including PNG, JPG, BMP, SVG, and GIF. For details, see [Image](../reference/arkui-ts/ts-basic-components-image.md).
......
# Creating a Grid # Creating a Grid (Grid/GridItem)
## Overview ## Overview
......
# Creating a List # Creating a List (List)
## Overview ## Overview
......
# Creating a Swiper # Creating a Swiper (Swiper)
The \<[Swiper](../reference/arkui-ts/ts-container-swiper.md)> component is a container that is able to display child components in looping mode. It is typically used in scenarios such as display of recommended content on the home page. The \<[Swiper](../reference/arkui-ts/ts-container-swiper.md)> component is a container that is able to display child components in looping mode. It is typically used in scenarios such as display of recommended content on the home page.
......
# Flex Layout # Flex Layout (Flex)
## Overview ## Overview
......
# Responsive Grid Layout # Responsive Grid Layout (GridRow/GridCol)
## Overview ## Overview
......
# Linear Layout # Linear Layout (Row/Column)
## Overview ## Overview
......
# Media Query # Media Query (mediaquery)
## Overview ## Overview
......
# Relative Layout # Relative Layout (RelativeContainer)
## Overview ## Overview
......
# Stack Layout # Stack Layout (Stack)
## Overview ## Overview
......
# Page Routing # Page Routing (router)
Page routing refers to the redirection and data transfer between different pages in an application. In OpenHarmony, page routing can be implemented through APIs of the **Router** module. Through different URLs, you can easily navigate users through pages. This document describes the functions provided by the **Router** module from the following aspects: [Page Redirection](#page-redirection), [Page Return](#page-return), and [Adding a Confirmation Dialog Box Before Page Return](#adding-a-confirmation-dialog-box-before-page-return). Page routing refers to the redirection and data transfer between different pages in an application. In OpenHarmony, page routing can be implemented through APIs of the **Router** module. Through different URLs, you can easily navigate users through pages. This document describes the functions provided by the **Router** module from the following aspects: [Page Redirection](#page-redirection), [Page Return](#page-return), and [Adding a Confirmation Dialog Box Before Page Return](#adding-a-confirmation-dialog-box-before-page-return).
......
# Spring Curve Animation # Spring Curve Animation
ArkUI provides [Preset Animation Curve] (../reference/arkui-ts/ts-appendix-enums.md#curve), which specifies the change rule of animation attributes from the start value to the end value, such as Linear, Ease, and EaseIn. At the same time, ArkUI also provides spring curves generated by the physical model of spring oscillators. Through the spring curve, developers can set the end value to be exceeded and oscillate around the end value until the end value stops. The animation effect of spring curve is more interactive and playable than other curves. ArkUI provides [preset animation curves](../reference/arkui-ts/ts-appendix-enums.md#curve), which specifies the change rule of animation attributes from the start value to the end value, such as Linear, Ease, and EaseIn. At the same time, ArkUI also provides spring curves generated by the physical model of spring oscillators. Through the spring curve, developers can set the end value to be exceeded and oscillate around the end value until the end value stops. The animation effect of spring curve is more interactive and playable than other curves.
There are two types of interfaces for spring curves: [springCurve](../reference/apis/js-apis-curve.md#curvesspringcurve9) and [springMotion](../reference/apis/js-apis-curve.md#curvesspringmotion9) and [responsiveSpringMotion](../reference/apis/js-apis-curve.md#curvesresponsivespringmotion9). Spring curves can be generated in both modes. There are two types of interfaces for spring curves: [springCurve](../reference/apis/js-apis-curve.md#curvesspringcurve9) and [springMotion](../reference/apis/js-apis-curve.md#curvesspringmotion9) and [responsiveSpringMotion](../reference/apis/js-apis-curve.md#curvesresponsivespringmotion9). Spring curves can be generated in both modes.
......
...@@ -11,7 +11,7 @@ You only need to perform operations in [Resource Files](#resource-files) and [Re ...@@ -11,7 +11,7 @@ You only need to perform operations in [Resource Files](#resource-files) and [Re
Resource files store application content in multiple languages. This framework uses JSON files to store resource definitions. Place the resource file of each locale in the i18n directory described in [File Organization](js-framework-file.md). Resource files store application content in multiple languages. This framework uses JSON files to store resource definitions. Place the resource file of each locale in the i18n directory described in [File Organization](js-framework-file.md).
Resource files should be named in _language-script-region_.json format. For example, the resource file for Hong Kong(China) in the traditional script is named zh-Hant-HK. You can omit the region, for example, en-US for simplified Chinese, or omit both the script and region, for example, zh for Chinese. Resource files should be named in _language-script-region_.json format. For example, the resource file for Hong Kong(China) in the traditional script is named zh-Hant-HK. You can omit the region, for example, zh-CN for simplified Chinese, or omit both the script and region, for example, zh for Chinese.
``` ```
......
...@@ -61,6 +61,8 @@ Set **width**, **height**, **background-color**, and **border** of the **&lt;can ...@@ -61,6 +61,8 @@ Set **width**, **height**, **background-color**, and **border** of the **&lt;can
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background-color: #F1F3F5; background-color: #F1F3F5;
width: 100%;
height: 100%;
} }
canvas{ canvas{
width: 500px; width: 500px;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册