From b8e613aadc6718c8b8b839097ff05f4570ca0da4 Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Fri, 29 Jul 2022 17:31:13 +0800 Subject: [PATCH] update docs Signed-off-by: ester.zhou --- .../arkui-ts/ts-basic-components-progress.md | 6 +- .../arkui-ts/ts-basic-components-slider.md | 17 +++--- .../reference/arkui-ts/ts-container-scroll.md | 55 +++++++++++-------- 3 files changed, 45 insertions(+), 33 deletions(-) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md b/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md index 83a445ec88..9310f9df68 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md @@ -91,7 +91,11 @@ struct ProgressExample { Text('Capsule Progress').fontSize(9).fontColor(0xCCCCCC).width('90%') Row({ space: 40 }) { Progress({ value: 10, type: ProgressType.Capsule }).width(100).height(50) - Progress({ value: 20, total: 150, type: ProgressType.Capsule }).color(Color.Grey).value(50).width(100).height(50) + Progress({ value: 20, total: 150, type: ProgressType.Capsule }) + .color(Color.Grey) + .value(50) + .width(100) + .height(50) } }.width('100%').margin({ top: 30 }) } diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md b/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md index 8716d4769e..93131f59b3 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md @@ -1,11 +1,12 @@ # Slider -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. -The **<Slider>** component is used to quickly adjust settings, such as the volume and brightness. +The *\** component is used to quickly adjust settings, such as the volume and brightness. ## Required Permissions @@ -15,7 +16,7 @@ None ## Child Components -None +Not supported ## APIs @@ -62,11 +63,11 @@ Among all the universal events, only **OnAppear** and **OnDisAppear** are suppor | onChange(callback: (value: number, mode: SliderChangeMode) => void) | Callback invoked when the slider slides.
**value**: current progress.
**mode**: dragging state. | - SliderChangeMode enums - | Name | Description | - | ------ | ----------------------------------- | - | Begin | The user starts to drag the slider. | - | Moving | The user is dragging the slider. | - | End | The user stops dragging the slider. | + | Name | Value | Description | + | ------ | ----- | ----------------------------------- | + | Begin | 0 | The user starts to drag the slider. | + | Moving | 1 | The user is dragging the slider. | + | End | 2 | The user stops dragging the slider. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-container-scroll.md b/en/application-dev/reference/arkui-ts/ts-container-scroll.md index fcb3dbc0af..81edff951a 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-scroll.md +++ b/en/application-dev/reference/arkui-ts/ts-container-scroll.md @@ -1,11 +1,11 @@ # Scroll -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. -The **<Scroll>** component scrolls the content when the layout size of a component exceeds the viewport of its parent component. +The **\** component scrolls the content when the layout size of a component exceeds the viewport of its parent component. ## Required Permissions @@ -28,8 +28,8 @@ Scroll(scroller?: Scroller) | Name | Type | Default Value | Description | | -------- | -------- | -------- | -------- | | scrollable | ScrollDirection | ScrollDirection.Vertical | Scroll method. | -| scrollBar | [BarState](ts-appendix-enums.md#barstate-enums) | Auto | Scroll bar status. | -| scrollBarColor | Color | - | Color of the scroll bar. | +| scrollBar | [BarState](ts-appendix-enums.md#barstate-enums) | ScrollDirection.Auto | Scrollbar status. | +| scrollBarColor | Color | - | Color of the scrollbar. | | scrollBarWidth | Length | - | Width of the scrollbar. | - ScrollDirection @@ -39,10 +39,18 @@ Scroll(scroller?: Scroller) | Vertical | Only vertical scrolling is supported. | | None | Scrolling is disabled. | +## Events + +| Name | Description | +| -------- | -------- | +| onScroll(xOffset: number, yOffset: number) => void | Invoked when scrolling starts. It returns the horizontal and vertical offsets. | +| onScrollEdge(side: Edge) => void | Invoked when scrolling reaches the edge. | +| onScrollEnd() => void | Invoked when scrolling stops. | + ## Scroller -Controller of the scrollable container component. You can bind this component to the container component and use it to control the scrolling of the container component. Currently, this component can be bound to the **<List>** and **<Scroll>** components. +Controller of the scrollable container component. You can bind this component to the container component and use it to control the scrolling of the container component. Currently, this component can be bound to the **\** and **\** components. ### Objects to Import @@ -53,7 +61,7 @@ scroller: Scroller = new Scroller() ``` -### scroller.scrollTo +### scrollTo scrollTo(value: { xOffset: number | string, yOffset: number | string, animation?: { duration: number, curve: Curve } }): void @@ -69,7 +77,7 @@ Scrolls to the specified position. | animation | {
duration: number,
curve: Curve \|
CubicBezier \|
SpringCurve
} | No | | Animation configuration, which includes the following:
- **duration**: scrolling duration.
- **curve**: scrolling curve. | -### scroller.scrollEdge +### scrollEdge scrollEdge(value: Edge): void @@ -83,7 +91,7 @@ Scrolls to the edge of the container. | value | Edge | Yes | - | Edge position to scroll to. | -### scroller.scrollPage +### scrollPage scrollPage(value: { next: boolean, direction?: Axis }): void @@ -95,7 +103,7 @@ Scrolls to the next or previous page. | next | boolean | Yes | - | Whether to turn to the next page. The value **true** means to scroll to the next page, and the value **false** means to scroll to the previous page. | -### scroller.currentOffset +### currentOffset scroller.currentOffset(): Object @@ -117,24 +125,17 @@ scroller.scrollToIndex(value: number): void Scrolls to the specified index. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> Only the **<List>** component is supported. +> **NOTE** +> +> Only the **\** component is supported. - Parameters - | Name | Type | Mandatory | Default Value | Description | + | Name | Type | Mandatory | Default Value | Description | | -------- | -------- | -------- | -------- | -------- | | value | number | Yes | - | Index of the item to be scrolled to in the list. | -## Events - -| Name | Description | -| -------- | -------- | -| onScroll(xOffset: number, yOffset: number) => void | Invoked to return the horizontal and vertical offsets during scrolling when the specified scroll event occurs. | -| onScrollEdge(side: Edge) => void | Callback for the event of scrolling to the edge. | -| onScrollEnd() => void | Invoked when scrolling stops. | - ## Example @@ -152,14 +153,20 @@ struct ScrollExample { Column() { ForEach(this.arr, (item) => { Text(item.toString()) - .width('90%').height(150).backgroundColor(0xFFFFFF) - .borderRadius(15).fontSize(16).textAlign(TextAlign.Center) + .width('90%') + .height(150) + .backgroundColor(0xFFFFFF) + .borderRadius(15) + .fontSize(16) + .textAlign(TextAlign.Center) .margin({ top: 10 }) }, item => item) }.width('100%') } - .scrollable(ScrollDirection.Vertical).scrollBar(BarState.On) - .scrollBarColor(Color.Gray).scrollBarWidth(30) + .scrollable(ScrollDirection.Vertical) + .scrollBar(BarState.On) + .scrollBarColor(Color.Gray) + .scrollBarWidth(30) .onScroll((xOffset: number, yOffset: number) => { console.info(xOffset + ' ' + yOffset) }) -- GitLab