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

!11832 CI报错清理

Merge pull request !11832 from LiAn/master
......@@ -2,426 +2,426 @@
## Color
| Color | Value | Illustration |
| ------------------------ | -------- | ------------------------------------------------------------ |
| Black | 0x000000 | ![en-us_image_0000001219864153](figures/en-us_image_0000001219864153.png) |
| Blue | 0x0000ff | ![en-us_image_0000001174104404](figures/en-us_image_0000001174104404.png) |
| Brown | 0xa52a2a | ![en-us_image_0000001219744201](figures/en-us_image_0000001219744201.png) |
| Gray | 0x808080 | ![en-us_image_0000001174264376](figures/en-us_image_0000001174264376.png) |
| Grey | 0x808080 | ![en-us_image_0000001174264376](figures/en-us_image_0000001174264376.png) |
| Green | 0x008000 | ![en-us_image_0000001174422914](figures/en-us_image_0000001174422914.png) |
| Orange | 0xffa500 | ![en-us_image_0000001219662661](figures/en-us_image_0000001219662661.png) |
| Pink | 0xffc0cb | ![en-us_image_0000001219662663](figures/en-us_image_0000001219662663.png) |
| Red | 0xff0000 | ![en-us_image_0000001219662665](figures/en-us_image_0000001219662665.png) |
| White | 0xffffff | ![en-us_image_0000001174582866](figures/en-us_image_0000001174582866.png) |
| Yellow | 0xffff00 | ![en-us_image_0000001174582864](figures/en-us_image_0000001174582864.png) |
| Transparent<sup>9+</sup> | rgba(0,0,0,0) | Transparent |
| Color | Value | Illustration |
| ------------------------ | ------------- | ---------------------------------------- |
| Black | 0x000000 | ![en-us_image_0000001219864153](figures/en-us_image_0000001219864153.png) |
| Blue | 0x0000ff | ![en-us_image_0000001174104404](figures/en-us_image_0000001174104404.png) |
| Brown | 0xa52a2a | ![en-us_image_0000001219744201](figures/en-us_image_0000001219744201.png) |
| Gray | 0x808080 | ![en-us_image_0000001174264376](figures/en-us_image_0000001174264376.png) |
| Grey | 0x808080 | ![en-us_image_0000001174264376](figures/en-us_image_0000001174264376.png) |
| Green | 0x008000 | ![en-us_image_0000001174422914](figures/en-us_image_0000001174422914.png) |
| Orange | 0xffa500 | ![en-us_image_0000001219662661](figures/en-us_image_0000001219662661.png) |
| Pink | 0xffc0cb | ![en-us_image_0000001219662663](figures/en-us_image_0000001219662663.png) |
| Red | 0xff0000 | ![en-us_image_0000001219662665](figures/en-us_image_0000001219662665.png) |
| White | 0xffffff | ![en-us_image_0000001174582866](figures/en-us_image_0000001174582866.png) |
| Yellow | 0xffff00 | ![en-us_image_0000001174582864](figures/en-us_image_0000001174582864.png) |
| Transparent<sup>9+</sup> | rgba(0,0,0,0) | Transparent |
## ImageFit
| Name | Description |
| --------- | ------------------------------------------------------------ |
| Contain | The image is scaled with its aspect ratio retained for the content to be completely displayed within the display boundaries. |
| Cover | The image is scaled with its aspect ratio retained for both sides to be greater than or equal to the display boundaries.|
| Auto | The image is scaled automatically to fit the display area. |
| Fill | The image is scaled to fill the display area, and its aspect ratio is not retained. |
| ScaleDown | The image is displayed with its aspect ratio retained, in a size smaller than or equal to the original size. |
| None | The original size is retained. |
| Name | Description |
| --------- | ---------------------------------------- |
| Contain | The image is scaled with its aspect ratio retained for the content to be completely displayed within the display boundaries. |
| Cover | The image is scaled with its aspect ratio retained for both sides to be greater than or equal to the display boundaries. |
| Auto | The image is scaled automatically to fit the display area. |
| Fill | The image is scaled to fill the display area, and its aspect ratio is not retained. |
| ScaleDown | The image is displayed with its aspect ratio retained, in a size smaller than or equal to the original size. |
| None | The original size is retained. |
## BorderStyle
| Name | Description |
| ------ | ----------------------------------------------- |
| Dotted | Dotted border. The radius of a dot is half of **borderWidth**.|
| Dashed | Dashed border. |
| Solid | Solid border. |
| Name | Description |
| ------ | ---------------------------------------- |
| Dotted | Dotted border. The radius of a dot is half of **borderWidth**. |
| Dashed | Dashed border. |
| Solid | Solid border. |
## LineJoinStyle
| Name | Description |
| ----- | -------------------- |
| Bevel | Bevel is used to connect paths.|
| Miter | Miter is used to connect paths.|
| Round | Round is used to connect paths.|
| Name | Description |
| ----- | ------------------------------- |
| Bevel | Bevel is used to connect paths. |
| Miter | Miter is used to connect paths. |
| Round | Round is used to connect paths. |
## TouchType
| Name | Description |
| ------ | ------------------------------ |
| Down | A finger is pressed. |
| Up | A finger is lifted. |
| Move | A finger moves on the screen in pressed state.|
| Cancel | A touch event is canceled. |
| Name | Description |
| ------ | ---------------------------------------- |
| Down | A finger is pressed. |
| Up | A finger is lifted. |
| Move | A finger moves on the screen in pressed state. |
| Cancel | A touch event is canceled. |
## MouseButton
| Name | Description |
| ------- | ---------------- |
| Left | Left button on the mouse. |
| Right | Right button on the mouse. |
| Middle | Middle button on the mouse. |
| Back | Back button on the left of the mouse.|
| Forward | Forward button on the left of the mouse.|
| None | No button. |
| Name | Description |
| ------- | ---------------------------------------- |
| Left | Left button on the mouse. |
| Right | Right button on the mouse. |
| Middle | Middle button on the mouse. |
| Back | Back button on the left of the mouse. |
| Forward | Forward button on the left of the mouse. |
| None | No button. |
## MouseAction
| Name | Description |
| ------- | -------------- |
| Press | The mouse button is pressed.|
| Release | The mouse button is released.|
| Move | The mouse cursor moves. |
| Hover | The mouse pointer is hovered on an element. |
| Name | Description |
| ------- | ---------------------------------------- |
| Press | The mouse button is pressed. |
| Release | The mouse button is released. |
| Move | The mouse cursor moves. |
| Hover | The mouse pointer is hovered on an element. |
## Curve
| Name | Description |
| ------------------- | ------------------------------------------------------------ |
| Linear | The animation speed keeps unchanged. |
| Ease | The animation starts slowly, accelerates, and then slows down towards the end. The cubic-bezier curve (0.25, 0.1, 0.25, 1.0) is used.|
| EaseIn | The animation starts at a low speed and then picks up speed until the end. The cubic-bezier curve (0.42, 0.0, 1.0, 1.0) is used. |
| EaseOut | The animation ends at a low speed. The cubic-bezier curve (0.0, 0.0, 0.58, 1.0) is used. |
| EaseInOut | The animation starts and ends at a low speed. The cubic-bezier curve (0.42, 0.0, 0.58, 1.0) is used.|
| FastOutSlowIn | The animation uses the standard cubic-bezier curve (0.4, 0.0, 0.2, 1.0). |
| LinearOutSlowIn | The animation uses the deceleration cubic-bezier curve (0.0, 0.0, 0.2, 1.0). |
| FastOutLinearIn | The animation uses the acceleration cubic-bezier curve (0.4, 0.0, 1.0, 1.0). |
| ExtremeDeceleration | The animation uses the extreme deceleration cubic-bezier curve (0.0, 0.0, 0.0, 1.0). |
| Sharp | The animation uses the sharp cubic-bezier curve (0.33, 0.0, 0.67, 1.0). |
| Rhythm | The animation uses the rhythm cubic-bezier curve (0.7, 0.0, 0.2, 1.0). |
| Smooth | The animation uses the smooth cubic-bezier curve (0.4, 0.0, 0.4, 1.0). |
| Friction | The animation uses the friction cubic-bezier curve (0.2, 0.0, 0.2, 1.0). |
| Name | Description |
| ------------------- | ---------------------------------------- |
| Linear | The animation speed keeps unchanged. |
| Ease | The animation starts slowly, accelerates, and then slows down towards the end. The cubic-bezier curve (0.25, 0.1, 0.25, 1.0) is used. |
| EaseIn | The animation starts at a low speed and then picks up speed until the end. The cubic-bezier curve (0.42, 0.0, 1.0, 1.0) is used. |
| EaseOut | The animation ends at a low speed. The cubic-bezier curve (0.0, 0.0, 0.58, 1.0) is used. |
| EaseInOut | The animation starts and ends at a low speed. The cubic-bezier curve (0.42, 0.0, 0.58, 1.0) is used. |
| FastOutSlowIn | The animation uses the standard cubic-bezier curve (0.4, 0.0, 0.2, 1.0). |
| LinearOutSlowIn | The animation uses the deceleration cubic-bezier curve (0.0, 0.0, 0.2, 1.0). |
| FastOutLinearIn | The animation uses the acceleration cubic-bezier curve (0.4, 0.0, 1.0, 1.0). |
| ExtremeDeceleration | The animation uses the extreme deceleration cubic-bezier curve (0.0, 0.0, 0.0, 1.0). |
| Sharp | The animation uses the sharp cubic-bezier curve (0.33, 0.0, 0.67, 1.0). |
| Rhythm | The animation uses the rhythm cubic-bezier curve (0.7, 0.0, 0.2, 1.0). |
| Smooth | The animation uses the smooth cubic-bezier curve (0.4, 0.0, 0.4, 1.0). |
| Friction | The animation uses the friction cubic-bezier curve (0.2, 0.0, 0.2, 1.0). |
## AnimationStatus
| Name | Description |
| ------- | ------------------ |
| Initial | The animation is in the initial state. |
| Running | The animation is being played.|
| Paused | The animation is paused.|
| Stopped | The animation is stopped.|
| Name | Description |
| ------- | -------------------------------------- |
| Initial | The animation is in the initial state. |
| Running | The animation is being played. |
| Paused | The animation is paused. |
| Stopped | The animation is stopped. |
## FillMode
| Name | Description |
| --------- | ------------------------------------------------------------ |
| None | Before execution, the animation does not apply any styles to the target component. After execution, the animation restores the target component to its default state.|
| Forwards | The target component retains the state set by the last keyframe encountered during execution of the animation. |
| Backwards | The animation applies the values defined in the first relevant keyframe once it is applied to the target component, and retains the values during the period set by **delay**. The first relevant keyframe depends on the value of **playMode**. If **playMode** is **Normal** or **Alternate**, the first relevant keyframe is in the **from** state. If **playMode** is **Reverse** or **AlternateReverse**, the first relevant keyframe is in the **to** state.|
| Both | The animation follows the rules for both **Forwards** and **Backwards**, extending the animation attributes in both directions.|
| Name | Description |
| --------- | ---------------------------------------- |
| None | Before execution, the animation does not apply any styles to the target component. After execution, the animation restores the target component to its default state. |
| Forwards | The target component retains the state set by the last keyframe encountered during execution of the animation. |
| Backwards | The animation applies the values defined in the first relevant keyframe once it is applied to the target component, and retains the values during the period set by **delay**. The first relevant keyframe depends on the value of **playMode**. If **playMode** is **Normal** or **Alternate**, the first relevant keyframe is in the **from** state. If **playMode** is **Reverse** or **AlternateReverse**, the first relevant keyframe is in the **to** state. |
| Both | The animation follows the rules for both **Forwards** and **Backwards**, extending the animation attributes in both directions. |
## PlayMode
| Name | Description |
| ---------------- | ------------------------------------------------------------ |
| Normal | The animation is played forwards. |
| Reverse | The animation is played backwards. |
| Alternate | The animation is played forwards for an odd number of times (1, 3, 5...) and backwards for an even number of times (2, 4, 6...).|
| AlternateReverse | The animation is played backwards for an odd number of times (1, 3, 5...) and forwards for an even number of times (2, 4, 6...).|
| Name | Description |
| ---------------- | ---------------------------------------- |
| Normal | The animation is played forwards. |
| Reverse | The animation is played backwards. |
| Alternate | The animation is played forwards for an odd number of times (1, 3, 5...) and backwards for an even number of times (2, 4, 6...). |
| AlternateReverse | The animation is played backwards for an odd number of times (1, 3, 5...) and forwards for an even number of times (2, 4, 6...). |
## KeyType
| Name| Description |
| ---- | ---------- |
| Down | The key is pressed.|
| Up | The key is released.|
| Name | Description |
| ---- | -------------------- |
| Down | The key is pressed. |
| Up | The key is released. |
## KeySource
| Name | Description |
| -------- | -------------------- |
| Unknown | Unknown input device. |
| Keyboard | The input device is a keyboard.|
| Name | Description |
| -------- | ------------------------------- |
| Unknown | Unknown input device. |
| Keyboard | The input device is a keyboard. |
## Edge
| Name | Description |
| -------- | ---------------------- |
| Top | Top edge in the vertical direction. |
| Center<sup>(deprecated) </sup> | Center position in the vertical direction.<br>This API is deprecated since API version 9. |
| Bottom | Bottom edge in the vertical direction. |
| Name | Description |
| -------------------------------- | ---------------------------------------- |
| Top | Top edge in the vertical direction. |
| Center<sup>(deprecated) </sup> | Center position in the vertical direction.<br>This API is deprecated since API version 9. |
| Bottom | Bottom edge in the vertical direction. |
| Baseline<sup>(deprecated) </sup> | Text baseline position in the cross axis direction.<br>This API is deprecated since API version 9. |
| Start | Start position in the horizontal direction. |
| Middle<sup>(deprecated) </sup> | Center position in the horizontal direction.<br>This API is deprecated since API version 9. |
| End | End position in the horizontal direction. |
| Start | Start position in the horizontal direction. |
| Middle<sup>(deprecated) </sup> | Center position in the horizontal direction.<br>This API is deprecated since API version 9. |
| End | End position in the horizontal direction. |
## Week
| Name | Description |
| -------- | ---------------------- |
| Mon | Monday. |
| Tue | Tuesday. |
| Wed | Wednesday. |
| Thur | Thursday. |
| Fri | Friday. |
| Sat | Saturday. |
| Sun | Sunday. |
| Name | Description |
| ---- | ----------- |
| Mon | Monday. |
| Tue | Tuesday. |
| Wed | Wednesday. |
| Thur | Thursday. |
| Fri | Friday. |
| Sat | Saturday. |
| Sun | Sunday. |
## Direction
| Name| Description |
| ---- | ---------------------- |
| Ltr | Components are arranged from left to right. |
| Rtl | Components are arranged from right to left. |
| Auto | The default layout direction is used.|
| Name | Description |
| ---- | ---------------------------------------- |
| Ltr | Components are arranged from left to right. |
| Rtl | Components are arranged from right to left. |
| Auto | The default layout direction is used. |
## BarState
| Name| Description |
| ---- | -------------------------------- |
| Off | Not displayed. |
| On | Always displayed. |
| Auto | Displayed when the screen is touched and hidden after 2s.|
| Name | Description |
| ---- | ---------------------------------------- |
| Off | Not displayed. |
| On | Always displayed. |
| Auto | Displayed when the screen is touched and hidden after 2s. |
## EdgeEffect
| Name | Description |
| ------ | ------------------------------------------------------------ |
| Spring | Spring effect. When at one of the edges, the component can move beyond the bounds through touches, and produces a bounce effect when the user releases their finger.|
| Fade | Fade effect. When at one of the edges, the component produces a fade effect. |
| None | No effect when the component is at one of the edges. |
| Name | Description |
| ------ | ---------------------------------------- |
| Spring | Spring effect. When at one of the edges, the component can move beyond the bounds through touches, and produces a bounce effect when the user releases their finger. |
| Fade | Fade effect. When at one of the edges, the component produces a fade effect. |
| None | No effect when the component is at one of the edges. |
## Alignment
| Name | Description |
| ----------- | ---------------- |
| TopStart | Top start. |
| Top | Horizontally centered on the top. |
| TopEnd | Top end. |
| Start | Vertically centered start.|
| Center | Horizontally and vertically centered.|
| End | Vertically centered end. |
| BottomStart | Bottom start. |
| Name | Description |
| ----------- | ------------------------------------- |
| TopStart | Top start. |
| Top | Horizontally centered on the top. |
| TopEnd | Top end. |
| Start | Vertically centered start. |
| Center | Horizontally and vertically centered. |
| End | Vertically centered end. |
| BottomStart | Bottom start. |
| Bottom | Horizontally centered on the bottom. |
| BottomEnd | Bottom end. |
| BottomEnd | Bottom end. |
## TransitionType
| Name | Description |
| ------ | -------------------------------------------------- |
| All | The transition takes effect in all scenarios.|
| Insert | The transition takes effect when a component is inserted. |
| Delete | The transition takes effect when a component is deleted. |
| Name | Description |
| ------ | ---------------------------------------- |
| All | The transition takes effect in all scenarios. |
| Insert | The transition takes effect when a component is inserted. |
| Delete | The transition takes effect when a component is deleted. |
## RelateType
| Name | Description |
| ------ | ------------------------------- |
| FILL | The current child component is scaled to fill the parent component. |
| FIT | The current child component is scaled to adapt to the parent component. |
| Name | Description |
| ---- | ---------------------------------------- |
| FILL | The current child component is scaled to fill the parent component. |
| FIT | The current child component is scaled to adapt to the parent component. |
## Visibility
| Name | Description |
| ------- | -------------------------------- |
| 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.|
| Name | Description |
| ------- | ---------------------------------------- |
| 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. |
## LineCapStyle
| Name | Description |
| ------ | -------------------- |
| Butt | The ends of the line are squared off, and the line does not extend beyond its two endpoints.|
| Round | The line is extended at the endpoints by a half circle whose diameter is equal to the line width.|
| Square | The line is extended at the endpoints by a rectangle whose width is equal to half the line width and height equal to the line width.|
| Name | Description |
| ------ | ---------------------------------------- |
| Butt | The ends of the line are squared off, and the line does not extend beyond its two endpoints. |
| Round | The line is extended at the endpoints by a half circle whose diameter is equal to the line width. |
| Square | The line is extended at the endpoints by a rectangle whose width is equal to half the line width and height equal to the line width. |
## Axis
| Name | Description |
| ---------- | ------------ |
| Vertical | Vertical direction.|
| Horizontal | Horizontal direction.|
| Name | Description |
| ---------- | --------------------- |
| Vertical | Vertical direction. |
| Horizontal | Horizontal direction. |
## HorizontalAlign
| Name | Description |
| ------ | ------------------------ |
| Start | Aligned with the start edge in the same direction as the language in use.|
| Center | Aligned with the center. This is the default alignment mode.|
| End | Aligned with the end edge in the same direction as the language in use. |
| Name | Description |
| ------ | ---------------------------------------- |
| Start | Aligned with the start edge in the same direction as the language in use. |
| Center | Aligned with the center. This is the default alignment mode. |
| End | Aligned with the end edge in the same direction as the language in use. |
## FlexAlign
| 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.|
| 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 evenly 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 any two adjacent components are the same. |
## ItemAlign
| Name | Description |
| -------- | ------------------------------------------------------------ |
| Auto | The default configuration in the flex container is used. |
| Start | The elements are in the flex container, top-aligned in the cross-axis direction. |
| Center | The elements are in the flex container, centered in the cross-axis direction. |
| End | The elements are in the flex container, bottom-aligned in the cross-axis direction. |
| Stretch | The elements are in the flex container, stretched and padded in the cross-axis direction. If the size is not set, the elements are stretched to the container size.|
| Baseline | The elements are in the flex container, text baseline aligned in the cross-axis direction. |
| Name | Description |
| -------- | ---------------------------------------- |
| Auto | The default configuration in the flex container is used. |
| Start | The elements are in the flex container, top-aligned in the cross-axis direction. |
| Center | The elements are in the flex container, centered in the cross-axis direction. |
| End | The elements are in the flex container, bottom-aligned in the cross-axis direction. |
| Stretch | The elements are in the flex container, stretched and padded in the cross-axis direction. If the size is not set, the elements are stretched to the container size. |
| Baseline | The elements are in the flex container, text baseline aligned in the cross-axis direction. |
## FlexDirection
| 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
| Name | Description |
| ----------- | ------------------------------------------------- |
| NoWrap | The child components in the flex container are arranged in a single line, and they cannot overflow. |
| Wrap | The child components in the flex container are arranged in multiple lines, and they may overflow. |
| WrapReverse | The child components in the flex container are reversely arranged in multiple lines, and they may overflow.|
| Name | Description |
| ----------- | ---------------------------------------- |
| NoWrap | The child components in the flex container are arranged in a single line, and they cannot overflow. |
| Wrap | The child components in the flex container are arranged in multiple lines, and they may overflow. |
| WrapReverse | The child components in the flex container are reversely arranged in multiple lines, and they may overflow. |
## VerticalAlign
| Name | Description |
| ------ | ------------------------ |
| Top | Top aligned. |
| Center | Center aligned. This is the default alignment mode.|
| Bottom | Bottom aligned. |
| Name | Description |
| ------ | ---------------------------------------- |
| Top | Top aligned. |
| Center | Center aligned. This is the default alignment mode. |
| Bottom | Bottom aligned. |
## ImageRepeat
| Name | Description |
| -------- | -------------------------- |
| X | The image is repeatedly drawn only along the horizontal axis.|
| Y | The image is repeatedly drawn only along the vertical axis.|
| XY | The image is repeatedly drawn along both axes. |
| NoRepeat | The image is not repeatedly drawn. |
| Name | Description |
| -------- | ---------------------------------------- |
| X | The image is repeatedly drawn only along the horizontal axis. |
| Y | The image is repeatedly drawn only along the vertical axis. |
| XY | The image is repeatedly drawn along both axes. |
| NoRepeat | The image is not repeatedly drawn. |
## ImageSize
| Type | Description |
| ------- | ------------------------------------------------------------ |
| Cover | Default value. 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. |
| Auto | The original image aspect ratio is retained. |
| Type | Description |
| ------- | ---------------------------------------- |
| Cover | Default value. 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. |
| Auto | The original image aspect ratio is retained. |
## GradientDirection
| Name | Description |
| ----------- | ---------- |
| Left | The gradient direction is from right to left.|
| Top | The gradient direction is from bottom to top.|
| Right | The gradient direction is from left to right.|
| Bottom | The gradient direction is from top to bottom.|
| Name | Description |
| ----------- | ---------------------------------------- |
| Left | The gradient direction is from right to left. |
| Top | The gradient direction is from bottom to top. |
| Right | The gradient direction is from left to right. |
| Bottom | The gradient direction is from top to bottom. |
| LeftTop | The gradient direction is upper left. |
| LeftBottom | The gradient direction is lower left. |
| RightTop | The gradient direction is upper right. |
| RightBottom | The gradient direction is lower right. |
| None | No gradient. |
| RightTop | The gradient direction is upper right. |
| RightBottom | The gradient direction is lower right. |
| None | No gradient. |
## SharedTransitionEffectType
| Name | Description |
| ----------- | ---------- |
| Static | The element position remains unchanged on the target page, and transition opacity can be configured. Currently, this effect is only valid in redirecting to the target page.|
| Exchange | The element is relocated and scaled properly on the target page.|
| Name | Description |
| -------- | ---------------------------------------- |
| Static | The element position remains unchanged on the target page, and transition opacity can be configured. Currently, this effect is only valid in redirecting to the target page. |
| Exchange | The element is relocated and scaled properly on the target page. |
## FontStyle
| Name | Description |
| ------ | ---------------- |
| Normal | Standard font style.|
| Italic | Italic font style.|
| Name | Description |
| ------ | -------------------- |
| Normal | Standard font style. |
| Italic | Italic font style. |
## FontWeight
| Name | Description |
| ------- | -------------- |
| Lighter | The font weight is lighter. |
| Normal | The font weight is normal.|
| Regular | The font weight is regular.|
| Medium | The font weight is medium.|
| Name | Description |
| ------- | --------------------------- |
| Lighter | The font weight is lighter. |
| Normal | The font weight is normal. |
| Regular | The font weight is regular. |
| Medium | The font weight is medium. |
| Bold | The font weight is bold. |
| Bolder | The font weight is bolder. |
## TextAlign
| Name | Description |
| ------ | -------------- |
| Start | Aligned with the start.|
| Center | Horizontally centered.|
| End | Aligned with the end.|
| Name | Description |
| ------ | ----------------------- |
| Start | Aligned with the start. |
| Center | Horizontally centered. |
| End | Aligned with the end. |
## TextOverflow
| Name | Description |
| -------- | -------------------------------------- |
| Name | Description |
| -------- | ---------------------------------------- |
| Clip | Extra-long text is clipped. |
| Ellipsis | An ellipsis (...) is used to represent clipped text.|
| None | No clipping or ellipsis is used for extra-long text. |
| Ellipsis | An ellipsis (...) is used to represent clipped text. |
| None | No clipping or ellipsis is used for extra-long text. |
## TextDecorationType
| Name | Description |
| ----------- | ------------------ |
| Underline | Line under the text. |
| LineThrough | Line through the text.|
| Overline | Line over the text. |
| None | No decorative lines.|
| Name | Description |
| ----------- | ---------------------- |
| Underline | Line under the text. |
| LineThrough | Line through the text. |
| Overline | Line over the text. |
| None | No decorative lines. |
## TextCase
| Name | Description |
| --------- | -------------------- |
| Normal | The original case of the text is retained.|
| LowerCase | All letters in the text are in lowercase. |
| UpperCase | All letters in the text are in uppercase. |
| Name | Description |
| --------- | ---------------------------------------- |
| Normal | The original case of the text is retained. |
| LowerCase | All letters in the text are in lowercase. |
| UpperCase | All letters in the text are in uppercase. |
## ResponseType<sup>8+</sup>
| Name | Description |
| ---------- | -------------------------- |
| LongPress | The menu is displayed when the component is long-pressed. |
| RightClick | The menu is displayed when the component is right-clicked.|
| Name | Description |
| ---------- | ---------------------------------------- |
| LongPress | The menu is displayed when the component is long-pressed. |
| RightClick | The menu is displayed when the component is right-clicked. |
## HoverEffect<sup>8+</sup>
| Name | Description |
| --------- | ---------------------------- |
| Auto | Default hover effect.|
| Scale | Scale effect. |
| Highlight | Background fade-in and fade-out effect. |
| None | No effect. |
| Name | Description |
| --------- | --------------------------------------- |
| Auto | Default hover effect. |
| Scale | Scale effect. |
| Highlight | Background fade-in and fade-out effect. |
| None | No effect. |
## Placement<sup>8+</sup>
| Name | Description |
| ------------- | ------------------------------------------------------------ |
| Left | The popup is on the left of the component, vertically aligned with the component on the left. |
| Right | The popup is on the right of the component, vertically aligned with the component on the right. |
| Top | The popup is at the top of the component, horizontally aligned with the component at the top. |
| Bottom | The popup is at the bottom of the component, horizontally aligned with the component at the bottom. |
| TopLeft | The popup is at the top of the component and, since API version 9, aligned with the left of the component.|
| TopRight | The popup is at the top of the component and, since API version 9, aligned with the right of the component.|
| BottomLeft | The popup is at the bottom of the component and, since API version 9, aligned with the left of the component.|
| BottomRight | The popup is at the bottom of the component and, since API version 9, aligned with the right of the component.|
| LeftTop9+ | The popup is on the left of the component and aligned with the top of the component. |
| LeftBottom9+ | The popup is on the left of the component and aligned with the bottom of the component. |
| RightTop9+ | The popup is on the right of the component and aligned with the top of the component. |
| RightBottom9+ | The popup is on the right of the component and aligned with the bottom of the component. |
| Name | Description |
| ------------- | ---------------------------------------- |
| Left | The popup is on the left of the component, vertically aligned with the component on the left. |
| Right | The popup is on the right of the component, vertically aligned with the component on the right. |
| Top | The popup is at the top of the component, horizontally aligned with the component at the top. |
| Bottom | The popup is at the bottom of the component, horizontally aligned with the component at the bottom. |
| TopLeft | The popup is at the top of the component and, since API version 9, aligned with the left of the component. |
| TopRight | The popup is at the top of the component and, since API version 9, aligned with the right of the component. |
| BottomLeft | The popup is at the bottom of the component and, since API version 9, aligned with the left of the component. |
| BottomRight | The popup is at the bottom of the component and, since API version 9, aligned with the right of the component. |
| LeftTop9+ | The popup is on the left of the component and aligned with the top of the component. |
| LeftBottom9+ | The popup is on the left of the component and aligned with the bottom of the component. |
| RightTop9+ | The popup is on the right of the component and aligned with the top of the component. |
| RightBottom9+ | The popup is on the right of the component and aligned with the bottom of the component. |
## CopyOptions<sup>9+</sup>
| Name | Description |
| ----------- | -------------------- |
| None | Copy is not allowed. |
| InApp | Intra-application copy is allowed.|
| LocalDevice | Intra-device copy is allowed.|
| Name | Description |
| ----------- | ---------------------------------- |
| None | Copy is not allowed. |
| InApp | Intra-application copy is allowed. |
| LocalDevice | Intra-device copy is allowed. |
## HitTestMode<sup>9+</sup>
| Name | Description |
| ----------- | -------------------- |
| Default | Both the node and its child node respond to the hit test of a touch event, but its sibling node is blocked from the hit test. |
| Block | The node responds to the hit test of a touch event, but its child node and sibling node are blocked from the hit test. |
| Transparent | Both the node and its child node respond to the hit test of a touch event, and its sibling node is also considered during the hit test.|
| None | The node does not respond to the hit test of a touch event, but its child node and sibling node are considered during the hit test.|
| Name | Description |
| ----------- | ---------------------------------------- |
| Default | Both the node and its child node respond to the hit test of a touch event, but its sibling node is blocked from the hit test. |
| Block | The node responds to the hit test of a touch event, but its child node and sibling node are blocked from the hit test. |
| Transparent | Both the node and its child node respond to the hit test of a touch event, and its sibling node is also considered during the hit test. |
| None | The node does not respond to the hit test of a touch event, but its child node and sibling node are considered during the hit test. |
......@@ -16,31 +16,31 @@ Refresh\(value: \{ refreshing: boolean, offset?: number | string , friction?: n
**Parameters**
| Name| Value Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| refreshing | boolean | Yes| Whether the current component is being refreshed.<br>This parameter can be used with [$$](../../ui/ts-syntactic-sugar.md) for two-way binding of variables.|
| offset | string \| number | No| Distance to the top of the parent component from the **<Refresh\>** component that comes to rest after a successful pull-down gesture.<br>Default value: **16**, in vp|
| friction | number \| string | No| Coefficient of friction, which indicates the **<Refresh\>** component's sensitivity to the pull-down gesture. The value ranges from 0 to 100.<br>Default value: **62**<br>- **0** indicates that the **\<Refresh>** component is not sensitive to the pull-down gesture.<br>- **100** indicates that the **\<Refresh>** component is highly sensitive to the pull-down gesture.<br>- A larger value indicates a more sensitive response of the **\<Refresh>** component to the pull-down gesture.|
| Name | Value Type | Mandatory | Description |
| ---------- | ---------------- | --------- | ---------------------------------------- |
| refreshing | boolean | Yes | Whether the current component is being refreshed.<br>This parameter can be used with $$ for two-way binding of variables. |
| offset | string \| number | No | Distance to the top of the parent component from the **<Refresh\>** component that comes to rest after a successful pull-down gesture.<br>Default value: **16**, in vp |
| friction | number \| string | No | Coefficient of friction, which indicates the **<Refresh\>** component's sensitivity to the pull-down gesture. The value ranges from 0 to 100.<br>Default value: **62**<br>- **0** indicates that the **\<Refresh>** component is not sensitive to the pull-down gesture.<br>- **100** indicates that the **\<Refresh>** component is highly sensitive to the pull-down gesture.<br>- A larger value indicates a more sensitive response of the **\<Refresh>** component to the pull-down gesture. |
## Events
| Name| Description|
| -------- | -------- |
| onStateChange(callback: (state: RefreshStatus) => void)| Triggered when the refresh status changes.<br>- **state**: refresh status.|
| onRefreshing(callback: () => void)| Triggered when the component enters the refresh state.|
| Name | Description |
| ---------------------------------------- | ---------------------------------------- |
| onStateChange(callback: (state: RefreshStatus) => void) | Triggered when the refresh status changes.<br>- **state**: refresh status. |
| onRefreshing(callback: () => void) | Triggered when the component enters the refresh state. |
## RefreshStatus enums
| Name| Description|
| -------- | -------- |
| Inactive | The component is not pulled down. This is the default value.|
| Drag | The component is being pulled down, but the pulled distance is shorter than the minimum length required to trigger the refresh.|
| OverDrag | The component is being pulled down, and the pulled distance exceeds the minimum length required to trigger the refresh.|
| Refresh | The pull-down ends, and the component rebounds to the minimum length required to trigger the refresh and enters the refresh state.|
| Done | The refresh is complete, and the component returns to the initial state (top).|
| Name | Description |
| -------- | ---------------------------------------- |
| Inactive | The component is not pulled down. This is the default value. |
| Drag | The component is being pulled down, but the pulled distance is shorter than the minimum length required to trigger the refresh. |
| OverDrag | The component is being pulled down, and the pulled distance exceeds the minimum length required to trigger the refresh. |
| Refresh | The pull-down ends, and the component rebounds to the minimum length required to trigger the refresh and enters the refresh state. |
| Done | The refresh is complete, and the component returns to the initial state (top). |
## Example
......
......@@ -16,30 +16,30 @@ CustomDialogController(value:{builder: CustomDialog, cancel?: () =&gt; void, aut
**Parameters**
| Name | Type | Mandatory | Description |
| ---------------------- | ---------------------------------------- | ------------------------- | ---------------------- |
| builder | [CustomDialog](../../ui/ts-component-based-customdialog.md) | Yes | Constructor of the custom dialog box content. |
| cancel | () =&gt; void | No | Callback invoked when the dialog box is closed after the overlay exits. |
| autoCancel | boolean | No | Whether to allow users to click the overlay to exit.<br>Default value: **true** |
| alignment | [DialogAlignment](#dialogalignment) | No | Alignment mode of the dialog box in the vertical direction.<br>Default value: **DialogAlignment.Default** |
| offset | {<br>dx: Length \| [Resource](ts-types.md#resource),<br>dy: Length \| [Resource](ts-types.md#resource)<br>} | No | Offset of the dialog box relative to the alignment position.|
| customStyle | boolean | No | Whether to use a custom style for the dialog box.<br>Default value: **false** |
| gridCount<sup>8+</sup> | number | No | Number of grid columns occupied by the dialog box. |
| Name | Type | Mandatory | Description |
| ---------------------- | ---------------------------------------- | --------- | ---------------------------------------- |
| builder | CustomDialog | Yes | Constructor of the custom dialog box content. |
| cancel | () =&gt; void | No | Callback invoked when the dialog box is closed after the overlay exits. |
| autoCancel | boolean | No | Whether to allow users to click the overlay to exit.<br>Default value: **true** |
| alignment | [DialogAlignment](#dialogalignment) | No | Alignment mode of the dialog box in the vertical direction.<br>Default value: **DialogAlignment.Default** |
| offset | {<br>dx: Length \| [Resource](ts-types.md#resource),<br>dy: Length \| [Resource](ts-types.md#resource)<br>} | No | Offset of the dialog box relative to the alignment position. |
| customStyle | boolean | No | Whether to use a custom style for the dialog box.<br>Default value: **false** |
| gridCount<sup>8+</sup> | number | No | Number of grid columns occupied by the dialog box. |
## DialogAlignment
| Name | Description |
| ------------------------ | ------- |
| Top | Vertical top alignment.|
| Center | Vertical center alignment.|
| Bottom | Vertical bottom alignment.|
| Default | Default alignment. |
| TopStart<sup>8+</sup> | Top left alignment. |
| TopEnd<sup>8+</sup> | Top right alignment. |
| CenterStart<sup>8+</sup> | Center left alignment. |
| CenterEnd<sup>8+</sup> | Center right alignment. |
| BottomStart<sup>8+</sup> | Bottom left alignment. |
| BottomEnd<sup>8+</sup> | Bottom right alignment. |
| Name | Description |
| ------------------------ | -------------------------- |
| Top | Vertical top alignment. |
| Center | Vertical center alignment. |
| Bottom | Vertical bottom alignment. |
| Default | Default alignment. |
| TopStart<sup>8+</sup> | Top left alignment. |
| TopEnd<sup>8+</sup> | Top right alignment. |
| CenterStart<sup>8+</sup> | Center left alignment. |
| CenterEnd<sup>8+</sup> | Center right alignment. |
| BottomStart<sup>8+</sup> | Bottom left alignment. |
| BottomEnd<sup>8+</sup> | Bottom right alignment. |
## CustomDialogController
......
......@@ -13,21 +13,21 @@ show(options?: TextPickerDialogOptions)
Shows a text picker in the given settings.
- TextPickerDialogOptions
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| range | string[] \| [Resource](../../ui/ts-types.md#resource)| Yes| - | Data selection range of the picker.|
| selected | number | No| 0 | Index of the selected item in the range.|
| value | string | No | - | Value of the selected item. This parameter does not take effect when the **selected** parameter is set. If the value is not within the range, the first item in the range is used instead.|
| defaultPickerItemHeight | number \| string | No| - | Default height of an item in the picker.|
| onAccept | (value: TextPickerResult) => void | No| - | Callback invoked when the OK button in the dialog box is clicked.|
| onCancel | () => void | No| - | Callback invoked when the Cancel button in the dialog box is clicked.|
| onChange | (value: TextPickerResult) => void | No| - | Callback invoked when the selected item in the picker changes.|
| Name | Type | Mandatory | Default Value | Description |
| ----------------------- | ---------------------------------------- | --------- | ------------- | ---------------------------------------- |
| range | string[] \| [Resource](ts-types.md#resource) | Yes | - | Data selection range of the picker. |
| selected | number | No | 0 | Index of the selected item in the range. |
| value | string | No | - | Value of the selected item. This parameter does not take effect when the **selected** parameter is set. If the value is not within the range, the first item in the range is used instead. |
| defaultPickerItemHeight | number \| string | No | - | Default height of an item in the picker. |
| onAccept | (value: TextPickerResult) => void | No | - | Callback invoked when the OK button in the dialog box is clicked. |
| onCancel | () => void | No | - | Callback invoked when the Cancel button in the dialog box is clicked. |
| onChange | (value: TextPickerResult) => void | No | - | Callback invoked when the selected item in the picker changes. |
- TextPickerResult
| Name| Type| Description|
| -------- | -------- | -------- |
| value | string | Value of the selected item.|
| index | number | Index of the selected item in the range.|
| Name | Type | Description |
| ----- | ------ | ---------------------------------------- |
| value | string | Value of the selected item. |
| index | number | Index of the selected item in the range. |
## Example
......
......@@ -105,7 +105,7 @@ export default {
> **NOTE**
> - For wearables, the input type can only be **button**, **radio**, or **checkbox**.
>
>
> - The settings of **checked** take effect only when the input type is set to **checkbox** or **radio**. The default value of **checked** is **false**.
......
......@@ -69,32 +69,32 @@ You can create resource group sub-directories (including element, media, animati
**Table 3** Resource group sub-directories
| Resource Group Sub-directory | Description | Resource File |
| ---------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| Resource Group Sub-directory | Description | Resource File |
| ---------------------------- | ---------------------------------------- | ---------------------------------------- |
| element | Element resources. Each type of data is represented by a JSON file. The options are as follows:<br>- **boolean**: boolean data<br>- **color**: color data<br>- **float**: floating-point data<br>- **intarray**: array of integer<br>- **integer**: integer data<br>- **pattern**: pattern data<br>- **plural**: plural form data<br>- **strarray**: array of strings<br>- **string**: string data | It is recommended that files in the **element** sub-directory be named the same as the following files, each of which can contain only data of the same type:<br>- boolean.json<br>- color.json<br>- float.json<br>- intarray.json<br>- integer.json<br>- pattern.json<br>- plural.json<br>- strarray.json<br>- string.json |
| media | Media resources, including non-text files such as images, audios, and videos. | The file name can be customized, for example, **icon.png**. |
| profile | Other types of files, which are stored in their raw formats. | The file name can be customized. |
| media | Media resources, including non-text files such as images, audios, and videos. | The file name can be customized, for example, **icon.png**. |
| profile | Other types of files, which are stored in their raw formats. | The file name can be customized. |
### Media Resource Types
**Table 4** Image resource types
| Format| File Name Extension|
| -------- | -------- |
| JPEG | .jpg |
| PNG | .png |
| GIF | .gif |
| SVG | .svg |
| WEBP | .webp |
| BMP | .bmp |
| Format | File Name Extension |
| ------ | ------------------- |
| JPEG | .jpg |
| PNG | .png |
| GIF | .gif |
| SVG | .svg |
| WEBP | .webp |
| BMP | .bmp |
**Table 5** Audio and video resource types
| Format| File Name Extension|
| -------- | -------- |
| H.263 | .3gp <br>.mp4 |
| H.264 AVC <br> Baseline Profile (BP) | .3gp <br>.mp4 |
| MPEG-4 SP | .3gp |
| VP8 | .webm <br> .mkv |
| Format | File Name Extension |
| ------------------------------------ | ------------------- |
| H.263 | .3gp <br>.mp4 |
| H.264 AVC <br> Baseline Profile (BP) | .3gp <br>.mp4 |
| MPEG-4 SP | .3gp |
| VP8 | .webm <br> .mkv |
## Creating a Resource File
You can create a sub-directory and its files under the **resources** directory based on the above descriptions of the qualifiers sub-directories and resource group sub-directories.
......
......@@ -16,7 +16,7 @@ TS语言的使用在生成器函数中存在以下限制:
错误示例:
```
build() {
let a: number = 1 // invalid: variable declaration not allowed
......@@ -36,7 +36,7 @@ build() {
在应用中,通过"$r('app.string.xx')"的形式引用应用资源,$r的第二个参数可用于替换%s占位符。
示例:
```
build() {
//do something
......@@ -60,7 +60,7 @@ build() {
示例:
```
resourceManager.getRawFile(path, (error, value) => {
if (error != null) {
......@@ -96,7 +96,7 @@ Stage模型支持了通过context获取resourceManager对象的方式,再调
示例:
```
const context = getContext(this) as any
context
......@@ -113,7 +113,7 @@ context
aboutToAppear函数中使用异步接口获取页面数据,使用\@State修饰变量,数据获取完成后根据变量自动刷新页面。
```
@Entry
@Component
......@@ -180,7 +180,7 @@ systemTime.getCurrentTime(false)和new Date().getTime()一样,都是返回1970
适用于:OpenHarmony SDK3.2.6.5, API9 Stage模型
\@BuilderParam修饰的属性进行赋值时不带参数(如:content: this.specificParam),则此属性的类型需定义成无返回值的函数(如:\@BuilderParam content: () =&gt; void);若带参数(如:callContent: this.specificParam1("111")),则此属性的类型需定义成any(如:\@BuilderParam callContent: any;),具体用法请参考[BuilderParam](../ui/ts-component-based-builder.md)
\@BuilderParam修饰的属性进行赋值时不带参数(如:content: this.specificParam),则此属性的类型需定义成无返回值的函数(如:\@BuilderParam content: () =&gt; void);若带参数(如:callContent: this.specificParam1("111")),则此属性的类型需定义成any(如:\@BuilderParam callContent: any;),具体用法请参考[BuilderParam](../quick-start/arkts-dynamic-ui-elememt-building.md#builderparam8)
## ArkTS如何把string转成byte数组
......@@ -188,7 +188,7 @@ systemTime.getCurrentTime(false)和new Date().getTime()一样,都是返回1970
参考如下代码实现,示例:
```
function stringToByte(str) {
var bytes = new Array();
......@@ -263,7 +263,7 @@ OpenHarmony推荐使用worker来处理多线程场景。
适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型
- namespace导出
```
namespace Util{
export function getTime(){
......@@ -274,7 +274,7 @@ OpenHarmony推荐使用worker来处理多线程场景。
```
- namespace导入
```
import Util from './util'
Util.getTime()
......
......@@ -10,15 +10,15 @@
### 接口说明
| 模块 | 接口名称 | 描述 |
| -------- | -------- | -------- |
| ohos.i18n | getSystemLanguage():string | 获取系统语言。 |
| ohos.i18n | getSystemRegion():string | 获取系统区域。 |
| ohos.i18n | getSystemLocale():string | 获取系统Locale。 |
| 模块 | 接口名称 | 描述 |
| --------- | ---------------------------------------- | --------------------- |
| ohos.i18n | getSystemLanguage():string | 获取系统语言。 |
| ohos.i18n | getSystemRegion():string | 获取系统区域。 |
| ohos.i18n | getSystemLocale():string | 获取系统Locale。 |
| ohos.i18n | isRTL(locale:string):boolean<sup>7+</sup> | locale对应的语言是否为从右到左语言。 |
| ohos.i18n | is24HourClock():boolean<sup>7+</sup> | 获取当前系统时间是否采用24小时制。 |
| ohos.i18n | getDisplayLanguage(language:string,locale:string,sentenceCase?:boolean):string | 获取语言的本地化表示。 |
| ohos.i18n | getDisplayCountry(country:string,locale:string,sentenceCase?:boolean):string | 获取国家的本地化表示。 |
| ohos.i18n | is24HourClock():boolean<sup>7+</sup> | 获取当前系统时间是否采用24小时制。 |
| ohos.i18n | getDisplayLanguage(language:string,locale:string,sentenceCase?:boolean):string | 获取语言的本地化表示。 |
| ohos.i18n | getDisplayCountry(country:string,locale:string,sentenceCase?:boolean):string | 获取国家的本地化表示。 |
### 开发步骤
......@@ -33,7 +33,7 @@
2. 获取系统区域。
调用getSystemRegion方法获取当前系统设置的区域
```js
var region = i18n.getSystemRegion();
```
......@@ -41,7 +41,7 @@
3. 获取系统Locale。
调用getSystemLocale方法获取当前系统设置的Locale
```js
var locale = i18n.getSystemLocale();
```
......@@ -57,7 +57,7 @@
5. 判断当前系统时间是否采用24小时制。
调用is24HourClock方法来判断当前系统的时间是否采用24小时制。
```js
var hourClock = i18n.is24HourClock();
```
......@@ -65,7 +65,7 @@
6. 获取语言的本地化表示。
调用getDisplayLanguage方法获取某一语言的本地化表示。其中,language表示待本地化显示的语言,locale表示本地化的Locale,sentenceCase结果是否需要首字母大写。
```js
var language = "en";
var locale = "zh-CN";
......@@ -76,7 +76,7 @@
7. 获取国家的本地化表示。
调用getDisplayCountry方法获取某一国家的本地化表示。其中,country表示待本地化显示的国家,locale表示本地化的Locale,sentenceCase结果是否需要首字母大写。
```js
var country = "US";
var locale = "zh-CN";
......@@ -90,27 +90,27 @@
### 接口说明
| 模块 | 接口名称 | 描述 |
| -------- | -------- | -------- |
| 模块 | 接口名称 | 描述 |
| --------- | ---------------------------------------- | --------------------- |
| ohos.i18n | getCalendar(locale:string,type?:string):Calendar<sup>8+</sup> | 获取指定locale和type的日历对象。 |
| ohos.i18n | setTime(date:Date): void<sup>8+</sup> | 设置日历对象内部的时间日期。 |
| ohos.i18n | setTime(time:number): void<sup>8+</sup> | 设置日历对象内部的时间日期。 |
| ohos.i18n | set(year:number,month:number,date:number,hour?:number,minute?:number,second?:number): void<sup>8+</sup> | 设置日历对象的年、月、日、时、分、秒。 |
| ohos.i18n | setTimeZone(timezone:string): void<sup>8+</sup> | 设置日历对象的时区。 |
| ohos.i18n | getTimeZone():string<sup>8+</sup> | 获取日历对象的时区。 |
| ohos.i18n | getFirstDayOfWeek():number<sup>8+</sup> | 获取日历对象的一周起始日。 |
| ohos.i18n | setFirstDayOfWeek(value:number): void<sup>8+</sup> | 设置日历对象的一周起始日。 |
| ohos.i18n | getMinimalDaysInFirstWeek():number<sup>8+</sup> | 获取一年中第一周的最小天数。 |
| ohos.i18n | setMinimalDaysInFirstWeek(value:number): void<sup>8+</sup> | 设置一年中第一周的最小天数。 |
| ohos.i18n | getDisplayName(locale:string):string<sup>8+</sup> | 获取日历对象的本地化表示。 |
| ohos.i18n | isWeekend(date?:Date):boolean<sup>8+</sup> | 判断给定的日期是否在日历中是周末。 |
| ohos.i18n | setTime(date:Date): void<sup>8+</sup> | 设置日历对象内部的时间日期。 |
| ohos.i18n | setTime(time:number): void<sup>8+</sup> | 设置日历对象内部的时间日期。 |
| ohos.i18n | set(year:number,month:number,date:number,hour?:number,minute?:number,second?:number): void<sup>8+</sup> | 设置日历对象的年、月、日、时、分、秒。 |
| ohos.i18n | setTimeZone(timezone:string): void<sup>8+</sup> | 设置日历对象的时区。 |
| ohos.i18n | getTimeZone():string<sup>8+</sup> | 获取日历对象的时区。 |
| ohos.i18n | getFirstDayOfWeek():number<sup>8+</sup> | 获取日历对象的一周起始日。 |
| ohos.i18n | setFirstDayOfWeek(value:number): void<sup>8+</sup> | 设置日历对象的一周起始日。 |
| ohos.i18n | getMinimalDaysInFirstWeek():number<sup>8+</sup> | 获取一年中第一周的最小天数。 |
| ohos.i18n | setMinimalDaysInFirstWeek(value:number): void<sup>8+</sup> | 设置一年中第一周的最小天数。 |
| ohos.i18n | getDisplayName(locale:string):string<sup>8+</sup> | 获取日历对象的本地化表示。 |
| ohos.i18n | isWeekend(date?:Date):boolean<sup>8+</sup> | 判断给定的日期是否在日历中是周末。 |
### 开发步骤
1. 实例化日历对象。
调用getCalendar方法获取指定locale和type的时区对象(i18n为导入的模块)。其中,type表示合法的日历类型,目前合法的日历类型包括:"buddhist", "chinese", "coptic", "ethiopic", "hebrew", "gregory", "indian", "islamic_civil", "islamic_tbla", "islamic_umalqura", "japanese", "persian"。当type没有给出时,采用区域默认的日历类型。
```js
var calendar = i18n.getCalendar("zh-CN", "gregory");
```
......@@ -118,7 +118,7 @@
2. 设置日历对象的时间。
调用setTime方法设置日历对象的时间。setTime方法接收两种类型的参数。一种是传入一个Date对象,另一种是传入一个数值表示从1970.1.1 00:00:00 GMT逝去的毫秒数。
```js
var date1 = new Date();
calendar.setTime(date1);
......@@ -129,7 +129,7 @@
3. 设置日历对象的年、月、日、时、分、秒。
调用set方法设置日历对象的年、月、日、时、分、秒。
```js
calendar.set(2021, 12, 21, 6, 0, 0)
```
......@@ -137,7 +137,7 @@
4. 设置、获取日历对象的时区。
调用setTimeZone方法和getTimeZone方法来设置、获取日历对象的时区。其中,setTimeZone方法需要传入一个字符串表示需要设置的时区。
```js
calendar.setTimeZone("Asia/Shanghai");
var timezone = calendar.getTimeZone();
......@@ -154,7 +154,7 @@
6. 设置、获取日历对象第一周的最小天数
调用setMinimalDaysInFirstWeek方法和getMinimalDaysInFirstWeek方法来设置、获取日历对象第一周的最小天数。
```js
calendar.setMinimalDaysInFirstWeek(3);
var minimalDaysInFirstWeek = calendar.getMinimalDaysInFirstWeek();
......@@ -162,7 +162,7 @@
7. 获取日历对象的本地化显示
调用getDisplayName来获取日历对象的本地化显示。
```js
var localizedName = calendar.getDisplayName("zh-CN");
```
......@@ -170,7 +170,7 @@
8. 判断某一个日期是否为周末。
调用isWeekend方法来判断输入的Date是否为周末。
```js
var date = new Date();
var weekend = calendar.isWeekend(date);
......@@ -182,18 +182,18 @@
### 接口说明
| 模块 | 接口名称 | 描述 |
| -------- | -------- | -------- |
| 模块 | 接口名称 | 描述 |
| --------- | ---------------------------------------- | ----------------------- |
| ohos.i18n | constructor(country:string,options?:PhoneNumberFormatOptions)<sup>8+</sup> | 实例化PhoneNumberFormat对象。 |
| ohos.i18n | isValidNumber(number:string):boolean<sup>8+</sup> | 判断number是否是一个格式正确的电话号码。 |
| ohos.i18n | format(number:string):string<sup>8+</sup> | 对number按照指定国家及风格进行格式化。 |
| ohos.i18n | format(number:string):string<sup>8+</sup> | 对number按照指定国家及风格进行格式化。 |
### 开发步骤
1. 实例化电话号码格式化对象。
调用PhoneNumberFormat的构造函数来实例化电话号码格式化对象,需要传入电话号码的国家代码及格式化选项。其中,格式化选项是可选的,包括style选项,该选项的取值包括:"E164", "INTERNATIONAL", "NATIONAL", "RFC3966"。
```js
var phoneNumberFormat = new i18n.PhoneNumberFormat("CN", {type: "E164"});
```
......@@ -201,7 +201,7 @@
2. 判断电话号码格式是否正确。
调用isValidNumber方法来判断输入的电话号码的格式是否正确。
```js
var validNumber = phoneNumberFormat.isValidNumber("15812341234");
```
......@@ -209,7 +209,7 @@
3. 电话号码格式化。
调用电话号码格式化对象的format方法来对输入的电话号码进行格式化。
```js
var formattedNumber = phoneNumberFormat.format("15812341234");
```
......@@ -220,15 +220,15 @@
### 接口说明
| 模块 | 接口名称 | 描述 |
| -------- | -------- | -------- |
| 模块 | 接口名称 | 描述 |
| --------- | ---------------------------------------- | --------------------------------------- |
| ohos.i18n | unitConvert(fromUnit:UnitInfo,toUnit:UnitInfo,value:number,locale:string,style?:string):string<sup>8+</sup> | 将fromUnit的单位转换为toUnit的单位,并根据区域与风格进行格式化。 |
### 开发步骤
1. 度量衡单位转换。
调用[unitConvert](../reference/apis/js-apis-i18n.md#unitconvert8)方法实现度量衡单位转换,并进行格式化显示的功能。
调用[unitConvert](../reference/apis/js-apis-i18n.md#unitconvert9)方法实现度量衡单位转换,并进行格式化显示的功能。
```js
var fromUnit = {unit: "cup", measureSystem: "US"};
......@@ -245,12 +245,12 @@
### 接口说明
| 模块 | 接口名称 | 描述 |
| -------- | -------- | -------- |
| ohos.i18n | getInstance(locale?:string):IndexUtil<sup>8+</sup> | 实例化字母表索引对象。 |
| ohos.i18n | getIndexList():Array&lt;string&gt;<sup>8+</sup> | 获取当前Locale的索引列表。 |
| 模块 | 接口名称 | 描述 |
| --------- | ---------------------------------------- | ----------------------- |
| ohos.i18n | getInstance(locale?:string):IndexUtil<sup>8+</sup> | 实例化字母表索引对象。 |
| ohos.i18n | getIndexList():Array&lt;string&gt;<sup>8+</sup> | 获取当前Locale的索引列表。 |
| ohos.i18n | addLocale(locale:string): void<sup>8+</sup> | 将新的Locale对应的索引加入当前索引列表。 |
| ohos.i18n | getIndex(text:string):string<sup>8+</sup> | 获取text对应的索引。 |
| ohos.i18n | getIndex(text:string):string<sup>8+</sup> | 获取text对应的索引。 |
### 开发步骤
......@@ -258,7 +258,7 @@
调用getInstance方法来实例化特定locale对应的字母表索引对象。当locale参数为空时,实例化系统默认Locale的字母表索引对象。
```js
var indexUtil = i18n.getInstance("zh-CN");
```
......@@ -266,7 +266,7 @@
2. 获取索引列表。
调用getIndexList方法来获取当前Locale对应的字母表索引列表。
```js
var indexList = indexUtil.getIndexList();
```
......@@ -274,7 +274,7 @@
3. 增加新的索引。
调用addLocale方法,将新的Locale对应的字母表索引添加到当前字母表索引列表中。
```js
indexUtil.addLocale("ar")
```
......@@ -282,7 +282,7 @@
4. 获取字符串对应的索引。
调用getIndex方法来获取某一字符串对应的字母表索引。
```js
var text = "access index";
indexUtil.getIndex(text);
......@@ -294,18 +294,18 @@
### 接口说明
| 模块 | 接口名称 | 描述 |
| -------- | -------- | -------- |
| ohos.i18n | getLineInstance(locale:string):BreakIterator<sup>8+</sup> | 实例化断行对象。 |
| ohos.i18n | setLineBreakText(text:string): void<sup>8+</sup> | 设置要处理的文本。 |
| ohos.i18n | getLineBreakText():string<sup>8+</sup> | 获取要处理的文本。 |
| ohos.i18n | current():number<sup>8+</sup> | 获取当前断行对象在处理文本的位置。 |
| ohos.i18n | first():number<sup>8+</sup> | 将断行对象设置到第一个可断句的分割点。 |
| ohos.i18n | last():number<sup>8+</sup> | 将断行对象设置到最后一个可断句的分割点。 |
| ohos.i18n | next(index?:number):number<sup>8+</sup> | 将断行对象移动index个分割点的位置。 |
| ohos.i18n | previous():number<sup>8+</sup> | 将断行对象移动到前一个分割点的位置。 |
| 模块 | 接口名称 | 描述 |
| --------- | ---------------------------------------- | ------------------------------ |
| ohos.i18n | getLineInstance(locale:string):BreakIterator<sup>8+</sup> | 实例化断行对象。 |
| ohos.i18n | setLineBreakText(text:string): void<sup>8+</sup> | 设置要处理的文本。 |
| ohos.i18n | getLineBreakText():string<sup>8+</sup> | 获取要处理的文本。 |
| ohos.i18n | current():number<sup>8+</sup> | 获取当前断行对象在处理文本的位置。 |
| ohos.i18n | first():number<sup>8+</sup> | 将断行对象设置到第一个可断句的分割点。 |
| ohos.i18n | last():number<sup>8+</sup> | 将断行对象设置到最后一个可断句的分割点。 |
| ohos.i18n | next(index?:number):number<sup>8+</sup> | 将断行对象移动index个分割点的位置。 |
| ohos.i18n | previous():number<sup>8+</sup> | 将断行对象移动到前一个分割点的位置。 |
| ohos.i18n | following(offset:number):number<sup>8+</sup> | 将断行对象移动到offset指定位置的后面一个分割点的位置。 |
| ohos.i18n | isBoundary(offset:number):boolean<sup>8+</sup> | 判断某个位置是否是分割点。 |
| ohos.i18n | isBoundary(offset:number):boolean<sup>8+</sup> | 判断某个位置是否是分割点。 |
### 开发步骤
......@@ -331,7 +331,7 @@
3. 获取断行对象当前的位置。
调用current方法来获取断行对象在当前处理文本中的位置。
```js
var pos = breakIterator.current();
```
......@@ -355,7 +355,7 @@
5. 判断某个位置是否为分割点。
调用isBoundary方法来判断一个方法是否为分割点;如果该位置是分割点,则返回true,并且将断行对象移动到该位置;如果该位置不是分割点,则返回false,并且将断行对象移动到该位置后的一个分割点。
```js
var isboundary = breakIterator.isBoundary(5);
```
\ No newline at end of file
......@@ -30,7 +30,7 @@ matchMediaSync(condition: string): MediaQueryListener
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ---------------------------------------- |
| condition | string | 是 | 媒体事件的匹配条件,具体可参考[媒体查询语法规则](../../ui/ui-ts-layout-mediaquery.md#媒体查询条件语法规则)。 |
| condition | string | 是 | 媒体事件的匹配条件,具体可参考[媒体查询语法规则](../../ui/ui-ts-layout-mediaquery.md#语法规则)。 |
**返回值:**
| 类型 | 说明 |
......
......@@ -62,10 +62,10 @@
除支持[通用事件](../arkui-js/js-components-common-events.md)外,还支持如下事件:
| 名称 | 参数 | 描述 |
| -------------- | ---------------------------------------- | ------------------------- |
| complete(Rich) | {<br>&nbsp;width:width,<br>&nbsp;height:height<br>&nbsp;} | 图片成功加载时触发该回调,返回成功加载的图源尺寸。 |
| error(Rich) | {<br>&nbsp;width:width,<br>&nbsp;height:height<br>&nbsp;} | 图片加载出现异常时触发该回调,异常时长宽为零。 |
| 名称 | 参数 | 描述 |
| -------- | ---------------------------------------- | ------------------------- |
| complete | {<br>&nbsp;width:width,<br>&nbsp;height:height<br>&nbsp;} | 图片成功加载时触发该回调,返回成功加载的图源尺寸。 |
| error | {<br>&nbsp;width:width,<br>&nbsp;height:height<br>&nbsp;} | 图片加载出现异常时触发该回调,异常时长宽为零。 |
## 方法
......
......@@ -44,11 +44,11 @@
除支持[通用事件](../arkui-js/js-components-common-events.md)外,还支持如下事件:
| 名称 | 参数 | 描述 |
| ------------ | ---- | ---------------------------------------- |
| bounce(Rich) | - | 当文本滚动到末尾时触发该事件。 |
| finish(Rich) | - | 当完成滚动次数时触发该事件。需要在&nbsp;loop&nbsp;属性值大于&nbsp;0&nbsp;时触发。 |
| start(Rich) | - | 当文本滚动开始时触发该事件。 |
| 名称 | 参数 | 描述 |
| ------ | ---- | ---------------------------------------- |
| bounce | - | 当文本滚动到末尾时触发该事件。 |
| finish | - | 当完成滚动次数时触发该事件。需要在&nbsp;loop&nbsp;属性值大于&nbsp;0&nbsp;时触发。 |
| start | - | 当文本滚动开始时触发该事件。 |
## 方法
......
......@@ -33,16 +33,16 @@
除支持[通用样式](../arkui-js/js-components-common-styles.md)外,还支持如下样式:
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| ------------------- | -------------------------- | ---------- | ---- | ---------------------------------------- |
| texton-color(Rich) | &lt;color&gt; | \#000000 | 否 | 选中时显示的文本颜色,仅设置texton和textoff生效。 |
| textoff-color(Rich) | &lt;color&gt; | \#000000 | 否 | 未选中时显示的文本颜色,仅设置texton和textoff生效。 |
| text-padding(Rich) | number | 0px | 否 | texton/textoff中最长文本两侧距离滑块边界的距离。 |
| font-size(Rich) | &lt;length&gt; | - | 否 | 文本尺寸,仅设置texton和textoff生效。 |
| allow-scale(Rich) | boolean | true | 否 | 文本尺寸是否跟随系统设置字体缩放尺寸进行放大缩小。<br/>如果在config描述文件中针对ability配置了fontSize的config-changes标签,则应用不会重启而直接生效。 |
| font-style(Rich) | string | normal | 否 | 字体样式,仅设置texton和textoff生效。见text组件[font-style的样式属性](../arkui-js/js-components-basic-text.md#样式)。 |
| font-weight(Rich) | number&nbsp;\|&nbsp;string | normal | 否 | 字体粗细,仅设置texton和textoff生效。见text组件的[font-weight的样式属性](../arkui-js/js-components-basic-text.md#样式)。 |
| font-family(Rich) | string | sans-serif | 否 | 字体列表,用逗号分隔,每个字体用字体名或者字体族名设置。列表中第一个系统中存在的或者通过[自定义字体](../arkui-js/js-components-common-customizing-font.md)指定的字体,会被选中作为文本的字体。仅设置texton和textoff生效。 |
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| ------------- | -------------------------- | ---------- | ---- | ---------------------------------------- |
| texton-color | &lt;color&gt; | \#000000 | 否 | 选中时显示的文本颜色,仅设置texton和textoff生效。 |
| textoff-color | &lt;color&gt; | \#000000 | 否 | 未选中时显示的文本颜色,仅设置texton和textoff生效。 |
| text-padding | number | 0px | 否 | texton/textoff中最长文本两侧距离滑块边界的距离。 |
| font-size | &lt;length&gt; | - | 否 | 文本尺寸,仅设置texton和textoff生效。 |
| allow-scale | boolean | true | 否 | 文本尺寸是否跟随系统设置字体缩放尺寸进行放大缩小。<br/>如果在config描述文件中针对ability配置了fontSize的config-changes标签,则应用不会重启而直接生效。 |
| font-style | string | normal | 否 | 字体样式,仅设置texton和textoff生效。见text组件[font-style的样式属性](../arkui-js/js-components-basic-text.md#样式)。 |
| font-weight | number&nbsp;\|&nbsp;string | normal | 否 | 字体粗细,仅设置texton和textoff生效。见text组件的[font-weight的样式属性](../arkui-js/js-components-basic-text.md#样式)。 |
| font-family | string | sans-serif | 否 | 字体列表,用逗号分隔,每个字体用字体名或者字体族名设置。列表中第一个系统中存在的或者通过[自定义字体](../arkui-js/js-components-common-customizing-font.md)指定的字体,会被选中作为文本的字体。仅设置texton和textoff生效。 |
## 事件
......
......@@ -50,17 +50,17 @@ OpenHarmony提供了九种后台模式,供需要在后台做长时任务的业
**表1** 长时任务种类
| 后台模式 | 说明 | 通知栏显示提示 | 备注 |
| -------- | -------- | -------- | -------- |
| dataTransfer | 通过网络/对端设备进行数据下载、备份、分享、传输等 | 正在运行数据传输任务 | - |
| audioPlayback | 音频输出 | 正在运行音频播放任务 | - |
| audioRecording | 音频输入 | 正在运行录音任务 | - |
| location | 定位、导航 | 正在运行定位任务 | - |
| bluetoothInteraction | 蓝牙传输 | 正在运行蓝牙相关任务 | - |
| multiDeviceConnection | 分布式互联任务 | 正在运行分布式任务 | - |
| wifiInteraction | WLAN传输 | 正在运行WLAN相关任务 | System API,仅对System权限应用开放 |
| voip | 音视频电话、VOIP | 正在运行通话相关任务 | System API,仅对System权限应用开放 |
| taskKeeping | 计算任务 | 正在运行计算任务 | 仅在特定设备生效 |
| 后台模式 | 说明 | 通知栏显示提示 | 备注 |
| --------------------- | ------------------------- | ------------ | ------------------------- |
| dataTransfer | 通过网络/对端设备进行数据下载、备份、分享、传输等 | 正在运行数据传输任务 | - |
| audioPlayback | 音频输出 | 正在运行音频播放任务 | - |
| audioRecording | 音频输入 | 正在运行录音任务 | - |
| location | 定位、导航 | 正在运行定位任务 | - |
| bluetoothInteraction | 蓝牙传输 | 正在运行蓝牙相关任务 | - |
| multiDeviceConnection | 分布式互联任务 | 正在运行分布式任务 | - |
| wifiInteraction | WLAN传输 | 正在运行WLAN相关任务 | System API,仅对System权限应用开放 |
| voip | 音视频电话、VOIP | 正在运行通话相关任务 | System API,仅对System权限应用开放 |
| taskKeeping | 计算任务 | 正在运行计算任务 | 仅在特定设备生效 |
### 长时任务使用约束
- 如果用户选择可感知业务(如播音、导航等),触发对应后台模式,在任务启动时,系统会强制弹出通知提醒用户。
......@@ -79,15 +79,15 @@ OpenHarmony提供了九种后台模式,供需要在后台做长时任务的业
- **超时**:系统会设置超时机制,延迟任务回调只允许运行一段时间,超时之后,系统会主动停止。默认的超时限制为2分钟,对于系统应用,可以通过[申请能效资源](efficiency-resources-apply-dev-guide.md)获取更长的执行时间(充电状态20分钟,非充电状态10分钟)。
- **执行频率**:系统会根据应用的活跃度对延迟任务做分级管控,限制延迟任务调度的执行频率。对于通过能效资源接口申请了WORK_SCHEDULER资源的应用,在资源的有效期内,它的延迟任务执行频率不受限制。
| 应用分组 | 延迟任务执行频率约束 |
| --------------------|------------------------- |
| 活跃 | 最小间隔2小时 |
| 每日使用 | 最小间隔4小时 |
| 经常使用 | 最小间隔24小时 |
| 不经常使用 | 最小间隔48小时 |
| 受限分组 | 禁止 |
| 未使用分组 | 禁止 |
| [能效资源豁免分组](../reference/apis/js-apis-backgroundTaskManager.md#resourcetype9) | 执行频率不受限制 |
| 应用分组 | 延迟任务执行频率约束 |
| ---------------------------------------- | ---------- |
| 活跃 | 最小间隔2小时 |
| 每日使用 | 最小间隔4小时 |
| 经常使用 | 最小间隔24小时 |
| 不经常使用 | 最小间隔48小时 |
| 受限分组 | 禁止 |
| 未使用分组 | 禁止 |
| [能效资源豁免分组](../reference/apis/js-apis-resourceschedule-backgroundTaskManager.md#resourcetype) | 执行频率不受限制 |
- **WorkInfo设置参数约束**
......@@ -111,15 +111,15 @@ OpenHarmony提供了九种后台模式,供需要在后台做长时任务的业
**表1** 能效资源种类
| 参数名 | 参数值 | 描述 |
| ----------------------- | ---- | --------------------- |
| CPU | 1 | CPU资源,申请后不被挂起 |
| COMMON_EVENT | 2 | 公共事件,申请后挂起状态下不被代理掉 |
| TIMER | 4 | 计时器,申请后挂起状态下不被代理掉 |
| WORK_SCHEDULER | 8 | 延迟任务,申请后有更长的执行时间 |
| BLUETOOTH | 16 | 蓝牙相关,申请后挂起状态下不被代理掉 |
| GPS | 32 | GPS相关,申请后挂起状态下不被代理掉 |
| AUDIO | 64 | 音频资源,申请后挂起状态下不被代理掉 |
| 参数名 | 参数值 | 描述 |
| -------------- | ---- | ------------------- |
| CPU | 1 | CPU资源,申请后不被挂起 |
| COMMON_EVENT | 2 | 公共事件,申请后挂起状态下不被代理掉 |
| TIMER | 4 | 计时器,申请后挂起状态下不被代理掉 |
| WORK_SCHEDULER | 8 | 延迟任务,申请后有更长的执行时间 |
| BLUETOOTH | 16 | 蓝牙相关,申请后挂起状态下不被代理掉 |
| GPS | 32 | GPS相关,申请后挂起状态下不被代理掉 |
| AUDIO | 64 | 音频资源,申请后挂起状态下不被代理掉 |
### 能效资源使用约束
- 能效资源申请或者释放可以由进程或者应用发起,由应用发起的资源释放会释放属于它的同类型的所有资源,包括进程申请的资源。例如应用申请了CPU资源,进程申请了CPU和WORK_SCHEDULER资源,当应用释放CPU资源的时候,会将进程的CPU资源一同释放,同时不同类型的WORK_SCHEDULER资源不受影响。由进程发起的资源释放对应用申请的资源没有影响,例如当应用和进程同时申请了CPU,进程发起了CPU资源释放,应用的CPU资源不会被释放。
......
......@@ -10,10 +10,10 @@
**表1** 申请能效资源主要接口
| 接口名 | 描述 |
| ---------------------------------------- | ---------------------------------------- |
| applyEfficiencyResources(request: [EfficiencyResourcesRequest](../reference/apis/js-apis-backgroundTaskManager.md#efficiencyresourcesrequest9)): boolean | 申请能效资源。 |
| resetAllEfficiencyResources():void | 释放申请的能效资源。 |
| 接口名 | 描述 |
| ---------------------------------------- | ---------- |
| applyEfficiencyResources(request: [EfficiencyResourcesRequest](../reference/apis/js-apis-resourceschedule-backgroundTaskManager.md#efficiencyresourcesrequest)): boolean | 申请能效资源。 |
| resetAllEfficiencyResources():void | 释放申请的能效资源。 |
### 开发步骤
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册