提交 4f89ac36 编写于 作者: E ester.zhou

update docs (9111)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 53155573
# Gauge # Gauge
The **\<Gauge>** component is used to display data in a ring chart.
> **NOTE** > **NOTE**
> >
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
The **\<Gauge>** component is used to display data in a ring chart.
## Required Permissions ## Required Permissions
None None
...@@ -21,10 +20,10 @@ Not supported ...@@ -21,10 +20,10 @@ Not supported
## APIs ## APIs
Gauge(value:{value: number, min?: number, max?: number}) Gauge(options:{value: number, min?: number, max?: number})
- Parameters - Parameters
| Name| Type| Mandatory| Default Value| Description| | Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| value | number | Yes| - | Current data value.| | value | number | Yes| - | Current data value.|
| min | number | No| 0 | Minimum value of the current data segment.| | min | number | No| 0 | Minimum value of the current data segment.|
...@@ -38,9 +37,17 @@ Gauge(value:{value: number, min?: number, max?: number}) ...@@ -38,9 +37,17 @@ Gauge(value:{value: number, min?: number, max?: number})
| value | number | 0 | Value of the chart.| | value | number | 0 | Value of the chart.|
| startAngle | number | -150 | Start angle of the chart. The value 0 indicates 0 degrees, and a positive value indicates the clockwise direction.| | startAngle | number | -150 | Start angle of the chart. The value 0 indicates 0 degrees, and a positive value indicates the clockwise direction.|
| endAngle | number | 150 | End angle of the chart. The value 0 indicates 0 degrees, and a positive value indicates the clockwise direction.| | endAngle | number | 150 | End angle of the chart. The value 0 indicates 0 degrees, and a positive value indicates the clockwise direction.|
| colors | Array&lt;any&gt; | - | Colors of the chart. Solid colors and gradients are supported.| | colors | Array&lt;ColorStop&gt; | - | Colors of the chart. Colors can be set for individual segments.|
| strokeWidth | Length | - | Stroke width of the chart.| | strokeWidth | Length | - | Stroke width of the chart.|
## ColorStop
Describes a gradient stop.
| Name | Type | Description |
| --------- | -------------------- | ------------------------------------------------------------ |
| ColorStop | [[ResourceColor](../../ui/ts-types.md#resourcecolor8), number] | Type of the gradient stop. The first parameter specifies the color, and the second parameter specifies the offset, which ranges from 0 to 1.|
## Example ## Example
......
# Circle # Circle
The **\<Circle>** component is used to draw a circle.
> **NOTE**<br> > **NOTE**
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. >
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **<Circle\>** component is used to draw a circle.
## Required Permissions
None
## Child Components ## Child Components
None Not supported
## APIs ## APIs
Circle(options?: {width: Length, height: Length}) Circle(options?: {width?: string | number, height?: string | number})
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| options | Object | No | - | Options of the circle to draw. For details, see the **options** parameters. | | width | string \| number | No| 0 | Width of the circle. |
| height | string \| number | No| 0 | Height of the circle. |
- options parameters
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| width | Length | Yes | - | Width. |
| height | Length | Yes | - | Height. |
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| width | string \| number | Yes| - | Width.|
| height | string \| number | Yes| - | Height.|
## Attributes ## Attributes
| Name | Type | Default Value | Mandatory | Description | In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name| Type| Default Value| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| width | Length | 0 | No | Width of the rectangle where the circle is located. | | fill | [ResourceColor](../../ui/ts-types.md) | Color.Black | No| Color of the fill area.|
| height | Length | 0 | No | Height of the rectangle where the circle is located. | | fillOpacity | number \| string \| [Resource](../../ui/ts-types.md#resource-type)| 1 | No| Opacity of the fill area.|
| stroke | [ResourceColor](../../ui/ts-types.md) | Color.Black | No| Stroke color.|
| strokeDashArray | Array&lt;Length&gt; | [] | No| Stroke dashes.|
| strokeDashOffset | number \| string | 0 | No| Offset of the start point for drawing the stroke.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | No| Cap style of the stroke.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | No| Join style of the stroke.|
| strokeMiterLimit | number \| string | 4 | No| Limit value when the sharp angle is drawn as a miter.|
| strokeOpacity | number \| string \| [Resource](../../ui/ts-types.md#resource-type)| 1 | No| Stroke opacity.|
| strokeWidth | Length | 1 | No| Stroke width.|
| antiAlias | boolean | true | No| Whether anti-aliasing is enabled.|
## Example ## Example
```ts ```ts
// xxx.ets
@Entry @Entry
@Component @Component
struct CircleExample { struct CircleExample {
...@@ -60,4 +64,4 @@ struct CircleExample { ...@@ -60,4 +64,4 @@ struct CircleExample {
} }
``` ```
![en-us_image_0000001256978353](figures/en-us_image_0000001256978353.png) ![en-us_image_0000001256978353](figures/en-us_image_0000001256978353.png)
\ No newline at end of file
# Ellipse # Ellipse
> **NOTE**<br> The **\<Ellipse>** component is used to draw an ellipse.
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
> **NOTE**
The **<Ellipse\>** component is used to draw an ellipse. >
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Required Permissions ## Required Permissions
...@@ -15,37 +15,43 @@ None ...@@ -15,37 +15,43 @@ None
## Child Components ## Child Components
None Not supported
## APIs ## APIs
ellipse(options?: {width: Length, height: Length}) ellipse(options?: {width?: string | number, height?: string | number})
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| options | Object | No | - | Options of the ellipse to draw. For details, see the **options** parameters. | | width | string \| number | No| 0 | Width of the ellipse. |
| height | string \| number | No| 0 | Height of the ellipse. |
- options parameters
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| width | Length | Yes | - | Width of the ellipse. |
| height | Length | Yes | - | Height of the ellipse. |
## Attributes ## Attributes
| Name | Type | Default Value | Mandatory | Description | In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name| Type| Default Value| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| width | Length | 0 | No | Width of the rectangle where the ellipse is located. | | fill | [ResourceColor](../../ui/ts-types.md) | Color.Black | No| Color of the fill area.|
| height | Length | 0 | No | Height of the rectangle where the ellipse is located. | | fillOpacity | number \| string \| [Resource](../../ui/ts-types.md#resource)| 1 | No| Opacity of the fill area.|
| stroke | [ResourceColor](../../ui/ts-types.md) | Color.Black | No|Stroke color.|
| strokeDashArray | Array&lt;Length&gt; | [] | No| Stroke dash.|
| strokeDashOffset | number \| string | 0 | No| Offset of the start point for drawing the stroke.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | No| Cap style of the stroke.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | No| Join style of the stroke.|
| strokeMiterLimit | number \| string | 4 | No| Limit value when the sharp angle is drawn as a miter.|
| strokeOpacity | number \| string \| [Resource](../../ui/ts-types.md#resource)| 1 | No| Stroke opacity.|
| strokeWidth | Length | 1 | No| Stroke width.|
| antiAlias | boolean | true | No| Whether anti-aliasing is enabled.|
## Example ## Example
```ts ```ts
// xxx.ets
@Entry @Entry
@Component @Component
struct EllipseExample { struct EllipseExample {
...@@ -60,4 +66,4 @@ struct EllipseExample { ...@@ -60,4 +66,4 @@ struct EllipseExample {
} }
``` ```
![en-us_image_0000001212058488](figures/en-us_image_0000001212058488.png) ![en-us_image_0000001212058488](figures/en-us_image_0000001212058488.png)
\ No newline at end of file
# Line # Line
> **NOTE**<br> The **\<Line>** component is used to draw a straight line.
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
> **NOTE**
The **<Line\>** component is used to draw a straight line. >
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Required Permissions ## Required Permissions
...@@ -15,39 +15,45 @@ None ...@@ -15,39 +15,45 @@ None
## Child Components ## Child Components
None Not supported
## APIs ## APIs
Line(options?: {width: Length, height: Length}) Line(options?: {width?: string | number, height?: string | number})
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| options | Object | No | - | Options of the line to draw. For details, see the **options** parameters. | | width | string \| number | No| 0 | Width of the line. |
| height | string \| number | No| 0 | Height of the line. |
- options parameters
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| width | Length | Yes | - | Line width. |
| height | Length | Yes | - | Line height. |
## Attributes ## Attributes
| Name | Type | Default Value | Mandatory | Description | In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name| Type| Default Value| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| width | Length | 0 | No | Width of the rectangle where the straight line is located. | | startPoint | Array | [0, 0] | Yes | Coordinates (relative coordinates) of the start point of the line. |
| height | Length | 0 | No | Height of the rectangle where the straight line is located. | | endPoint | Array | [0, 0] | Yes | Coordinates (relative coordinates) of the end point of the line. |
| startPoint | Point | [0, 0] | Yes | Coordinate (relative coordinate) of the start point of the straight line. | | fill | [ResourceColor](../../ui/ts-types.md) | Color.Black | No| Color of the fill area.|
| endPoint | Point | [0, 0] | Yes | Coordinate (relative coordinate) of the end point of the straight line. | | fillOpacity | number \| string \| [Resource](../../ui/ts-types.md#resource)| 1 | No| Opacity of the fill area.|
| stroke | [ResourceColor](../../ui/ts-types.md) | Color.Black | No| Stroke color.|
| strokeDashArray | Array&lt;Length&gt; | [] | No| Stroke dashes.|
| strokeDashOffset | number \| string | 0 | No| Offset of the start point for drawing the stroke.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | No| Cap style of the stroke.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | No| Join style of the stroke.|
| strokeMiterLimit | number \| string | 4 | No| Limit value when the sharp angle is drawn as a miter.|
| strokeOpacity | number \| string \| [Resource](../../ui/ts-types.md#resource)| 1 | No| Stroke opacity.|
| strokeWidth | Length | 1 | No| Stroke width.|
| antiAlias | boolean | true | No| Whether anti-aliasing is enabled.|
## Example ## Example
```ts ```ts
// xxx.ets
@Entry @Entry
@Component @Component
struct LineExample { struct LineExample {
...@@ -60,4 +66,4 @@ struct LineExample { ...@@ -60,4 +66,4 @@ struct LineExample {
} }
``` ```
![en-us_image_0000001256858387](figures/en-us_image_0000001256858387.jpg) ![en-us_image_0000001256858387](figures/en-us_image_0000001256858387.jpg)
\ No newline at end of file
# Polygon # Polygon
> **NOTE**<br> The **\<Polygon>** component is used to draw a polygon.
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
> **NOTE**
The **<Polygon\>** component is used to draw a polygon. >
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Required Permissions ## Required Permissions
...@@ -15,38 +15,52 @@ None ...@@ -15,38 +15,52 @@ None
## Child Components ## Child Components
None Not supported
## APIs ## APIs
Polygon(value:{options?: {width: Length, height: Length}}) Polygon(options?: {width?: string | number, height?: string | number})
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| options | Object | No | - | Options of the polygon to draw. For details, see the **options** parameters. |
- options parameters
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| width | Length | Yes | - | Width of the polygon. | | width | string \| number | No| 0 | Width of the polygon. |
| height | Length | Yes | - | Height of the polygon. | | height | string \| number | No| 0 | Height of the polygon. |
## Attributes ## Attributes
| Name | Type | Default Value | Mandatory | Description | In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name| Type| Default Value| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| width | Length | 0 | No | Width of the rectangle where the polygon is located. | | points | Array&lt;Point&gt; | [] | No| Vertex coordinates of the polygon.|
| height | Length | 0 | No | Height of the rectangle where the polygon is located. | | fill | [ResourceColor](../../ui/ts-types.md) | Color.Black | No| Color of the fill area.|
| points | Array&lt;Point&gt; | - | Yes | Vertex coordinates of the polygon. | | fillOpacity | number \| string \| [Resource](../../ui/ts-types.md#resource)| 1 | No| Opacity of the fill area.|
| stroke | [ResourceColor](../../ui/ts-types.md) | Color.Black | No| Stroke color.|
| strokeDashArray | Array&lt;Length&gt; | [] | No| Stroke dashes.|
| strokeDashOffset | number \| string | 0 | No| Offset of the start point for drawing the stroke.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | No| Cap style of the stroke.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | No| Join style of the stroke.|
| strokeMiterLimit | number \| string | 4 | No| Limit value when the sharp angle is drawn as a miter.|
| strokeOpacity | number \| string \| [Resource](../../ui/ts-types.md#resource)| 1 | No| Stroke opacity.|
| strokeWidth | Length | 1 | No| Stroke width.|
| antiAlias | boolean | true | No| Whether anti-aliasing is enabled.|
## Point
Describes the coordinates of a point.
| Name | Type | Description |
| --------- | -------------------- | ------------------------------------------------------------ |
| Point | [number, number] | Coordinates of a point. The first parameter is the x-coordinate, and the second parameter is the y-coordinate (relative coordinate).|
## Example ## Example
```ts ```ts
// xxx.ets
@Entry @Entry
@Component @Component
struct PolygonExample { struct PolygonExample {
...@@ -55,7 +69,7 @@ struct PolygonExample { ...@@ -55,7 +69,7 @@ struct PolygonExample {
Flex({ justifyContent: FlexAlign.SpaceAround }) { Flex({ justifyContent: FlexAlign.SpaceAround }) {
// Draw a triangle in a 100 x 100 rectangle. The start point is (0, 0), the end point is (100, 0), and the passing point is (50, 100). // Draw a triangle in a 100 x 100 rectangle. The start point is (0, 0), the end point is (100, 0), and the passing point is (50, 100).
Polygon({ width: 100, height: 100 }).points([[0, 0], [50, 100], [100, 0]]) Polygon({ width: 100, height: 100 }).points([[0, 0], [50, 100], [100, 0]])
// Draw a quadrilateral in a 100 x 100 rectangle. The start point is (0, 0), the end point is (100, 0), and the passing point is (100, 100). // Draw a quadrilateral in a 100 x 100 rectangle. The start point is (0, 0), the end point is (100, 0), and the passing points are (0, 100) and (100, 100).
Polygon().width(100).height(100).points([[0, 0], [0, 100], [100, 100], [100, 0]]) Polygon().width(100).height(100).points([[0, 0], [0, 100], [100, 100], [100, 0]])
// Draw a pentagon in a 100 x 100 rectangle. The start point is (50, 0), the end point is (100, 50), and the passing points are (0, 50), (20, 100), and (80, 100). // Draw a pentagon in a 100 x 100 rectangle. The start point is (50, 0), the end point is (100, 50), and the passing points are (0, 50), (20, 100), and (80, 100).
Polygon().width(100).height(100).points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]]) Polygon().width(100).height(100).points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
......
# Polyline # Polyline
> **NOTE**<br> The **\<Polyline>** component is used to draw a polyline.
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
> **NOTE**
The **<Polyline\>** component is used to draw a polyline. >
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Required Permissions ## Required Permissions
...@@ -15,38 +15,51 @@ None ...@@ -15,38 +15,51 @@ None
## Child Components ## Child Components
None Not supported
## APIs ## APIs
Polyline(options?: {width: Length, height: Length}) Polyline(options?: {width?: string | number, height?: string | number})
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| options | Object | No | - | Options of the polyline to draw. For details, see the **options** parameters. |
- options parameters
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| width | Length | Yes | - | Width of the polyline. | | width | string \| number | No| 0 | Width of the polyline. |
| height | Length | Yes | - | Height of the polyline. | | height | string \| number | No| 0 | Height of the polyline. |
## Attributes ## Attributes
| Name | Type | Default Value | Mandatory | Description | In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| -------- | -------- | -------- | -------- | -------- |
| width | Length | 0 | No | Width of the rectangle where the polyline is located. |
| height | Length | 0 | No | Height of the rectangle where the polyline is located. |
| points | Array&lt;Point&gt; | - | Yes | List of coordinates that the polyline passes through. |
| Name| Type| Default Value| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- |
| points | Array&lt;Point&gt; | [] | No| List of coordinates that the polyline passes through.|
| fill | [ResourceColor](../../ui/ts-types.md) | Color.Black | No| Color of the fill area.|
| fillOpacity | number \| string \| [Resource](../../ui/ts-types.md#resource-type)| 1 | No| Opacity of the fill area.|
| stroke | [ResourceColor](../../ui/ts-types.md) | Color.Black | No| Stroke color.|
| strokeDashArray | Array&lt;Length&gt; | [] | No| Stroke dashes.|
| strokeDashOffset | number \| string | 0 | No| Offset of the start point for drawing the stroke.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | No| Cap style of the stroke.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | No| Join style of the stroke.|
| strokeMiterLimit | number \| string | 4 | No| Limit value when the sharp angle is drawn as a miter.|
| strokeOpacity | number \| string \| [Resource](../../ui/ts-types.md#resource-type)| 1 | No| Stroke opacity.|
| strokeWidth | Length | 1 | No| Stroke width.|
| antiAlias | boolean | true | No| Whether anti-aliasing is enabled.|
## Point
Describes the coordinates of a point.
| Name | Type | Description |
| --------- | -------------------- | ------------------------------------------------------------ |
| Point | [number, number] | Coordinates of a point. The first parameter is the x-coordinate, and the second parameter is the y-coordinate (relative coordinate).|
## Example ## Example
```ts ```ts
// xxx.ets
@Entry @Entry
@Component @Component
struct PolylineExample { struct PolylineExample {
...@@ -63,4 +76,4 @@ struct PolylineExample { ...@@ -63,4 +76,4 @@ struct PolylineExample {
} }
``` ```
![en-us_image_0000001212218432](figures/en-us_image_0000001212218432.gif) ![en-us_image_0000001212218432](figures/en-us_image_0000001212218432.gif)
\ No newline at end of file
# Rect # Rect
> **NOTE**<br> The **\<Rect>** component is used to draw a rectangle.
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **<Rect\>** component is used to draw a rectangle.
> **NOTE**
>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Required Permissions ## Required Permissions
...@@ -15,43 +14,50 @@ None ...@@ -15,43 +14,50 @@ None
## Child Components ## Child Components
None Not supported
## APIs ## APIs
Rect(value:{options?: {width: Length,height: Length,radius?: Length | Array&lt;Length&gt;} | {width: Length,height: Length,radiusWidth?: Length,radiusHeight?: Length}}) Rect(options?: {width?: string | number,height?: string | number,radius?: string | number | Array&lt;string | number&gt;} |
{width?: string | number,height?: string | number,radiusWidth?: string | number,radiusHeight?: string | number})
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| options | Object | No | - | Options of the rectangle to draw. For details, see the **options** parameters. | | width | string \| number | No| 0 | Width of the rectangle. |
| height | string \| number | No| 0 | Height of the rectangle. |
- options parameters | radius | string \| number \| Array&lt;string \| number&gt; | No| 0 | Radius of the rounded corner. You can set separate radiuses for four rounded corners.|
| Name | Type | Mandatory | Default Value | Description | | radiusWidth | string \| number | No| 0 | Width of the rounded corner.|
| -------- | -------- | -------- | -------- | -------- | | radiusHeight | string \| number | No| 0 | Height of the rounded corner.|
| width | Length | Yes | - | Width of the rectangle. |
| height | Length | Yes | - | Height of the rectangle. |
| radius | Length \| Array&lt;Length&gt; | No | 0 | Radius of the rounded corner. You can set the radius of four rounded corners. |
| radiusWidth | Length | No | 0 | Width of the rounded corner. |
| radiusHeight | Length | No | 0 | Height of the rounded corner. |
## Attributes ## Attributes
| Name | Type | Default Value | Mandatory | Description | In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name| Type| Default Value| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| width | Length | 0 | No | Width of the rectangle. | | radiusWidth | string \| number | 0 | No| Width of the rounded corner. The width and height are the same when only the width is set.|
| height | Length | 0 | No | Height of the rectangle. | | radiusHeight | string \| number | 0 | No| Height of the rounded corner. The width and height are the same only when the height is set.|
| radiusWidth | Length | 0 | No | Width of the rounded corner. The width and height are the same when only the width is set. | | radius | string \| number \| Array&lt;string \| number&gt; | 0 | No| Radius of the rounded corner. You can set separate radiuses for four rounded corners.|
| radiusHeight | Length | 0 | No | Height of the rounded corner. The width and height are the same only when the height is set. | | fill | [ResourceColor](../../ui/ts-types.md) | Color.Black | No| Color of the fill area.|
| radius | Length \| Array&lt;Length&gt; | 0 | No | Radius of the rounded corner. | | fillOpacity | number \| string \| [Resource](../../ui/ts-types.md#resource-type)| 1 | No| Opacity of the fill area.|
| stroke | [ResourceColor](../../ui/ts-types.md) | Color.Black | No| Stroke color.|
| strokeDashArray | Array&lt;Length&gt; | [] | No| Stroke dash.|
| strokeDashOffset | number \| string | 0 | No| Offset of the start point for drawing the stroke.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | No| Cap style of the stroke.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | No| Join style of the stroke.|
| strokeMiterLimit | number \| string | 4 | No| Limit value when the sharp angle is drawn as a miter.|
| strokeOpacity | number \| string \| [Resource](../../ui/ts-types.md#resource-type)| 1 | No| Stroke opacity.|
| strokeWidth | Length | 1 | No| Stroke width.|
| antiAlias | boolean | true | No| Whether anti-aliasing is enabled.|
## Example ## Example
```ts ```ts
// xxx.ets
@Entry @Entry
@Component @Component
struct RectExample { struct RectExample {
...@@ -73,4 +79,4 @@ struct RectExample { ...@@ -73,4 +79,4 @@ struct RectExample {
} }
``` ```
![en-us_image_0000001212218454](figures/en-us_image_0000001212218454.png) ![en-us_image_0000001212218454](figures/en-us_image_0000001212218454.png)
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册