提交 7528e652 编写于 作者: E ester.zhou

update docs

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 9507cd00
...@@ -24,9 +24,9 @@ Navigates to a specified page in the application. ...@@ -24,9 +24,9 @@ Navigates to a specified page in the application.
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| options | [RouterOptions](#routeroptions) | Yes| Page routing parameters.| | options | [RouterOptions](#routeroptions) | Yes| Page routing parameters.|
**Example** **Example**
...@@ -72,9 +72,9 @@ Replaces the current page with another one in the application and destroys the c ...@@ -72,9 +72,9 @@ Replaces the current page with another one in the application and destroys the c
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| options | [RouterOptions](#routeroptions) | Yes| Description of the new page.| | options | [RouterOptions](#routeroptions) | Yes| Description of the new page.|
**Example** **Example**
``` ```
...@@ -112,9 +112,9 @@ Returns to the previous page or a specified page. ...@@ -112,9 +112,9 @@ Returns to the previous page or a specified page.
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| options | [RouterOptions](#routeroptions) | Yes| Description of the page. The **url** parameter indicates the URL of the page to return to. If the specified page does not exist in the page stack, the application does not respond. If this parameter is not set, the application returns to the previous page.| | options | [RouterOptions](#routeroptions) | Yes| Description of the page. The **url** parameter indicates the URL of the page to return to. If the specified page does not exist in the page stack, the application does not respond. If this parameter is not set, the application returns to the previous page.|
**Example** **Example**
``` ```
...@@ -190,9 +190,9 @@ getLength(): string ...@@ -190,9 +190,9 @@ getLength(): string
Obtains the number of pages in the current stack. Obtains the number of pages in the current stack.
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Number of pages in the stack. The maximum value is **32**.| | string | Number of pages in the stack. The maximum value is **32**.|
**Example** **Example**
``` ```
...@@ -222,11 +222,11 @@ Describes the page routing state. ...@@ -222,11 +222,11 @@ Describes the page routing state.
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name| Type| Description| | Name| Type| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| index | number | Index of the current page in the stack.<br>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**NOTE**<br>>&nbsp;The index starts from 1 from the bottom to the top of the stack.| | index | number | Index of the current page in the stack.<br>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**NOTE**<br>>&nbsp;The index starts from 1 from the bottom to the top of the stack.|
| name | string | Name of the current page, that is, the file name.| | name | string | Name of the current page, that is, the file name.|
| path | string | Path of the current page.| | path | string | Path of the current page.|
**Example** **Example**
``` ```
...@@ -249,9 +249,9 @@ Enables the display of a confirm dialog box before returning to the previous pag ...@@ -249,9 +249,9 @@ Enables the display of a confirm dialog box before returning to the previous pag
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| options | [EnableAlertOptions](#enablealertoptions) | Yes| Description of the dialog box.| | options | [EnableAlertOptions](#enablealertoptions) | Yes| Description of the dialog box.|
**Example** **Example**
...@@ -289,6 +289,7 @@ Disables the display of a confirm dialog box before returning to the previous pa ...@@ -289,6 +289,7 @@ Disables the display of a confirm dialog box before returning to the previous pa
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Full
**Example** **Example**
``` ```
export default { export default {
disableAlertBeforeBackPage() { disableAlertBeforeBackPage() {
...@@ -311,6 +312,7 @@ Obtains the parameters passed from the page that initiates redirection to the cu ...@@ -311,6 +312,7 @@ Obtains the parameters passed from the page that initiates redirection to the cu
| ------ | ---------------------------------- | | ------ | ---------------------------------- |
| Object | Parameters passed from the page that initiates redirection to the current page.| | Object | Parameters passed from the page that initiates redirection to the current page.|
**Example** **Example**
- Web-like example - Web-like example
......
...@@ -15,25 +15,25 @@ None ...@@ -15,25 +15,25 @@ None
LongPressGesture(options?: { fingers?: number, repeat?: boolean, duration?: number }) LongPressGesture(options?: { fingers?: number, repeat?: boolean, duration?: number })
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| fingers | number | No | 1 | Minimum number of fingers to trigger a long press gesture. The value ranges from 1 to 10. | | fingers | number | No | 1 | Minimum number of fingers to trigger a long press gesture. The value ranges from 1 to 10. |
| repeat | boolean | No | false | Whether to continuously trigger the event callback. | | repeat | boolean | No | false | Whether to continuously trigger the event callback. |
| duration | number | No | 500 | Minimum hold-down time, in ms. | | duration | number | No | 500 | Minimum hold-down time, in ms. |
## Events ## Events
| Name | Description | | Name | Description |
| -------- | -------- | | -------- | -------- |
| onAction((event?: LongPressGestureEvent) =&gt; void) | Callback invoked when a long press gesture is recognized. | | onAction((event?: GestureEvent) =&gt; void) | Callback invoked when a long press gesture is recognized. |
| onActionEnd((event?: LongPressGestureEvent) =&gt; void) | Callback invoked when the finger used for a long press gesture is lift. | | onActionEnd((event?: GestureEvent) =&gt; void) | Callback invoked when the finger used for a long press gesture is lift. |
| onActionCancel(event: () =&gt; void) | Callback invoked when a tap cancellation event is received after a long press gesture is recognized. | | onActionCancel(event: () =&gt; void) | Callback invoked when a tap cancellation event is received after a long press gesture is recognized. |
- LongPressGestureEvent<sup>8+</sup> attributes - GestureEvent attributes related to the long press gesture
| Name | Type | Description | | Name | Type | Description |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| repeat | boolean | Whether the event is repeated. | | repeat | boolean | Whether the event is repeated. |
## Example ## Example
...@@ -53,7 +53,7 @@ struct LongPressGestureExample { ...@@ -53,7 +53,7 @@ struct LongPressGestureExample {
.gesture( .gesture(
LongPressGesture({ repeat: true }) LongPressGesture({ repeat: true })
// Repeatedly triggered when the long press gesture exists. // Repeatedly triggered when the long press gesture exists.
.onAction((event: LongPressGestureEvent) => { .onAction((event: GestureEvent) => {
if (event.repeat) { this.count++ } if (event.repeat) { this.count++ }
}) })
// Triggered when the long press gesture ends. // Triggered when the long press gesture ends.
......
...@@ -55,12 +55,12 @@ PanGestureOptions(options?: { fingers?: number, direction?: PanDirection, distan ...@@ -55,12 +55,12 @@ PanGestureOptions(options?: { fingers?: number, direction?: PanDirection, distan
| Name | Description | | Name | Description |
| -------- | -------- | | -------- | -------- |
| onActionStart(callback: (event?: PanGestureEvent) =&gt; void) | Callback for the pan gestures reorganization event. | | onActionStart(callback: (event?: GestureEvent) =&gt; void) | Callback for the pan gestures reorganization event. |
| onActionUpdate(callback: (event?: PanGestureEvent) =&gt; void) | Callback invoked when a pan gesture is recognized. | | onActionUpdate(callback: (event?: GestureEvent) =&gt; void) | Callback invoked when a pan gesture is recognized. |
| onActionEnd(callback: (event?: PanGestureEvent) =&gt; void) | Callback invoked when the finger used for a pan gesture is lift. | | onActionEnd(callback: (event?: GestureEvent) =&gt; void) | Callback invoked when the finger used for a pan gesture is lift. |
| onActionCancel(callback: () =&gt; void) | Callback invoked when a tap cancellation event is received after a pan gesture is recognized. | | onActionCancel(callback: () =&gt; void) | Callback invoked when a tap cancellation event is received after a pan gesture is recognized. |
- PanGestureEvent<sup>8+</sup> attributes - GestureEvent attributes related to the pan gesture
| Name | Type | Description | | Name | Type | Description |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| offsetX | number | Offset of the gesture event, in vp. | | offsetX | number | Offset of the gesture event, in vp. |
...@@ -85,10 +85,10 @@ struct PanGestureExample { ...@@ -85,10 +85,10 @@ struct PanGestureExample {
.translate({ x: this.offsetX, y: this.offsetY, z: 5 }) .translate({ x: this.offsetX, y: this.offsetY, z: 5 })
.gesture( .gesture(
PanGesture({}) PanGesture({})
.onActionStart((event: PanGestureEvent) => { .onActionStart((event: GestureEvent) => {
console.info('Pan start') console.info('Pan start')
}) })
.onActionUpdate((event: PanGestureEvent) => { .onActionUpdate((event: GestureEvent) => {
this.offsetX = event.offsetX this.offsetX = event.offsetX
this.offsetY = event.offsetY this.offsetY = event.offsetY
}) })
......
...@@ -15,27 +15,27 @@ None ...@@ -15,27 +15,27 @@ None
PinchGesture(options?: { fingers?: number, distance?: number }) PinchGesture(options?: { fingers?: number, distance?: number })
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| fingers | number | No | 2 | Minimum number of fingers to trigger a pinch. The value ranges from 2 to 5. | | fingers | number | No | 2 | Minimum number of fingers to trigger a pinch. The value ranges from 2 to 5. |
| distance | number | No | 3.0 | Minimum recognition distance, in vp. | | distance | number | No | 3.0 | Minimum recognition distance, in vp. |
## Events ## Events
| Name | Description | | Name | Description |
| -------- | -------- | | -------- | -------- |
| onActionStart((event?: PinchGestureEvent) =&gt; void) | Callback invoked when a pinch gesture is recognized. | | onActionStart((event?: GestureEvent) =&gt; void) | Callback invoked when a pinch gesture is recognized. |
| onActionUpdate((event?: PinchGestureEvent) =&gt; void) | Callback invoked during the movement of a pinch gesture. | | onActionUpdate((event?: GestureEvent) =&gt; void) | Callback invoked during the movement of a pinch gesture. |
| onActionEnd((event?: PinchGestureEvent) =&gt; void) | Callback invoked when the finger used for a pinch gesture is lift. | | onActionEnd((event?: GestureEvent) =&gt; void) | Callback invoked when the finger used for a pinch gesture is lift. |
| onActionCancel(event: () =&gt; void) | Callback invoked when a tap cancellation event is received after a pinch gesture is recognized. | | onActionCancel(event: () =&gt; void) | Callback invoked when a tap cancellation event is received after a pinch gesture is recognized. |
- PinchGestureEvent<sup>8+</sup> attributes - GestureEvent attributes related to the pinch gesture
| Name | Type | Description | | Name | Type | Description |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| scale | number | Scale ratio. This attribute is used for the pinch gesture. | | scale | number | Scale ratio. This attribute is used for the pinch gesture. |
| pinchCenterX | number | X-coordinate of the center of the pinch gesture, in px. | | pinchCenterX | number | X-coordinate of the center of the pinch gesture, in px. |
| pinchCenterY | number | Y-coordinate of the center of the pinch gesture, in px. | | pinchCenterY | number | Y-coordinate of the center of the pinch gesture, in px. |
## Example ## Example
...@@ -55,10 +55,10 @@ struct PinchGestureExample { ...@@ -55,10 +55,10 @@ struct PinchGestureExample {
.scale({ x: this.scale, y: this.scale, z: this.scale }) .scale({ x: this.scale, y: this.scale, z: this.scale })
.gesture( .gesture(
PinchGesture() PinchGesture()
.onActionStart((event: PinchGestureEvent) => { .onActionStart((event: GestureEvent) => {
console.info('Pinch start') console.info('Pinch start')
}) })
.onActionUpdate((event: PinchGestureEvent) => { .onActionUpdate((event: GestureEvent) => {
this.scale = event.scale this.scale = event.scale
}) })
.onActionEnd(() => { .onActionEnd(() => {
......
...@@ -15,25 +15,25 @@ None ...@@ -15,25 +15,25 @@ None
RotationGesture(options?: { fingers?: number, angle?: number }) RotationGesture(options?: { fingers?: number, angle?: number })
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| fingers | number | No | 2 | Minimum number of fingers to trigger a rotation. The value ranges from 2 to 5. | | fingers | number | No | 2 | Minimum number of fingers to trigger a rotation. The value ranges from 2 to 5. |
| angle | number | No | 1.0 | Minimum degree that can trigger the rotation gesture. | | angle | number | No | 1.0 | Minimum degree that can trigger the rotation gesture. |
## Events ## Events
| Name | Description | | Name | Description |
| -------- | -------- | | -------- | -------- |
| onActionStart((event?: RotationGestureEvent) =&gt; void) | Callback invoked when a rotation gesture is recognized. | | onActionStart((event?: GestureEvent) =&gt; void) | Callback invoked when a rotation gesture is recognized. |
| onActionUpdate((event?: RotationGestureEvent) =&gt; void) | Callback invoked during the movement of the rotation gesture. | | onActionUpdate((event?: GestureEvent) =&gt; void) | Callback invoked during the movement of the rotation gesture. |
| onActionEnd((event?: RotationGestureEvent) =&gt; void) | Callback invoked when the finger used for the rotation gesture is lift. | | onActionEnd((event?: GestureEvent) =&gt; void) | Callback invoked when the finger used for the rotation gesture is lift. |
| onActionCancel(event: () =&gt; void) | Callback invoked when a tap cancellation event is received after the rotation gesture is recognized. | | onActionCancel(event: () =&gt; void) | Callback invoked when a tap cancellation event is received after the rotation gesture is recognized. |
- RotationGestureEvent<sup>8+</sup> attributes - GestureEvent attributes related to the rotation gesture
| Name | Type | Description | | Name | Type | Description |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| angle | number | Rotation angle. | | angle | number | Rotation angle. |
## Example ## Example
...@@ -53,10 +53,10 @@ struct RotationGestureExample { ...@@ -53,10 +53,10 @@ struct RotationGestureExample {
.margin(80).rotate({ x:1, y:2, z:3, angle: this.angle }) .margin(80).rotate({ x:1, y:2, z:3, angle: this.angle })
.gesture( .gesture(
RotationGesture() RotationGesture()
.onActionStart((event: RotationGestureEvent) => { .onActionStart((event: GestureEvent) => {
console.log('Rotation start') console.log('Rotation start')
}) })
.onActionUpdate((event: RotationGestureEvent) => { .onActionUpdate((event: GestureEvent) => {
this.angle = event.angle this.angle = event.angle
}) })
.onActionEnd(() => { .onActionEnd(() => {
......
...@@ -15,32 +15,32 @@ None ...@@ -15,32 +15,32 @@ None
SwipeGesture(value?: { fingers?: number; direction?: SwipeDirection; speed?: number }) SwipeGesture(value?: { fingers?: number; direction?: SwipeDirection; speed?: number })
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| fingers | number | No | 1 | Minimum number of fingers to trigger a swipe gesture. The value ranges from 1 to 10. | | fingers | number | No | 1 | Minimum number of fingers to trigger a swipe gesture. The value ranges from 1 to 10. |
| direction | SwipeDirection | No | SwipeDirection.All | Swipe direction. | | direction | SwipeDirection | No | SwipeDirection.All | Swipe direction. |
| speed | number | No | 100 | Minimum speed of the swipe gesture (100 vp/s). | | speed | number | No | 100 | Minimum speed of the swipe gesture (100 vp/s). |
- SwipeDirection enums - SwipeDirection enums
| Name | Description | | Name | Description |
| -------- | -------- | | -------- | -------- |
| All | All directions. | | All | All directions. |
| Horizontal | Horizontal direction. | | Horizontal | Horizontal direction. |
| Vertical | Vertical direction. | | Vertical | Vertical direction. |
## Events ## Events
| Name | Description | | Name | Description |
| -------- | -------- | | -------- | -------- |
| onAction(callback:(event?: SwipeGestureEvent) =&gt; void) | Callback invoked when a swipe gesture is recognized. | | onAction(callback:(event?: GestureEvent) =&gt; void) | Callback invoked when a swipe gesture is recognized. |
- SwipeGestureEvent attributes - GestureEvent attributes related to the swipe gesture
| Name | Type | Description | | Name | Type | Description |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| angle | number | Angle of the swipe gesture. | | angle | number | Angle of the swipe gesture. |
| speed | number | Speed of the swipe gesture. | | speed | number | Speed of the swipe gesture. |
## Example ## Example
...@@ -64,7 +64,7 @@ struct SwipeGestureExample { ...@@ -64,7 +64,7 @@ struct SwipeGestureExample {
.rotate({x: 0, y: 0, z: 1, angle: this.rotateAngle}) .rotate({x: 0, y: 0, z: 1, angle: this.rotateAngle})
.gesture( .gesture(
SwipeGesture({fingers: 1, direction:SwipeDirection.Vertical}) SwipeGesture({fingers: 1, direction:SwipeDirection.Vertical})
.onAction((event: SwipeGestureEvent) => { .onAction((event: GestureEvent) => {
this.speed = event.speed this.speed = event.speed
this.rotateAngle = event.angle this.rotateAngle = event.angle
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册