From 853b74ee6f3a9ee0c32f3b0b2eeb1a8e69b92b95 Mon Sep 17 00:00:00 2001 From: luoying_ace Date: Sat, 29 Oct 2022 07:35:44 +0000 Subject: [PATCH] update zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md. Signed-off-by: luoying_ace --- .../reference/arkui-ts/ts-container-swiper.md | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md index be91208736..3ee143d2a1 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md @@ -42,7 +42,7 @@ Swiper(controller?: SwiperController) | disableSwipe8+ | boolean | 禁用组件滑动切换功能。
默认值:false | | curve8+ | [Curve](ts-appendix-enums.md#curve) \| string | 设置Swiper的动画曲线,默认为淡入淡出曲线,常用曲线参考[Curve枚举说明](ts-appendix-enums.md#curve),也可以通过[插值计算](../apis/js-apis-curve.md)模块提供的接口创建自定义的插值曲线对象。
默认值:Curve.Ease | | indicatorStyle8+ | {
left?: [Length](ts-types.md#length),
top?: [Length](ts-types.md#length),
right?: [Length](ts-types.md#length),
bottom?: [Length](ts-types.md#length),
size?: [Length](ts-types.md#length),
mask?: boolean,
color?: [ResourceColor](ts-types.md),
selectedColor?: [ResourceColor](ts-types.md)
} | 设置导航点样式:
\- left: 设置导航点距离Swiper组件左边的距离。
\- top: 设置导航点距离Swiper组件顶部的距离。
\- right: 设置导航点距离Swiper组件右边的距离。
\- bottom: 设置导航点距离Swiper组件底部的距离。
\- size: 设置导航点的直径。
\- mask: 设置是否显示导航点蒙层样式。
\- color: 设置导航点的颜色。
\- selectedColor: 设置选中的导航点的颜色。 | -| displayCount8+ | number\|string | 设置元素显示个数。
默认值:1 | +| displayCount8+ | number\|string | 设置一页内元素显示个数。
默认值:1 | | effectMode8+ | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | 滑动效果,目前支持的滑动效果参见EdgeEffect的枚举说明。
默认值:EdgeEffect.Spring | ## SwiperDisplayMode枚举说明 @@ -86,7 +86,7 @@ finishAnimation(callback?: () => void): void | 参数名 | 参数类型 | 必填项 | 参数描述 | | --------- | ---------- | ------ | -------- | -| callback | () => void | 是 | 动画结束的回调。 | +| callback | () => void | 否 | 动画结束的回调。 | ## 事件 @@ -96,11 +96,11 @@ onChange(event: (index: number) => void) 当前显示的子组件索引变化时触发该事件,返回值为当前显示的子组件的索引值。 -**参数:** +**返回值:** -| 参数名 | 参数类型 | 必填项 | 参数描述 | -| --------- | ---------- | ------ | -------- | -| index | number | 是 | 当前显示元素的索引。 | +| 名称 | 类型 | 参数描述 | +| --------- | ---------- | -------- | +| index | number | 当前显示元素的索引。 | ## 示例 @@ -149,36 +149,34 @@ struct SwiperExample { Column({ space: 5 }) { Swiper(this.swiperController) { LazyForEach(this.data, (item: string) => { - Text(item).width('90%').height(160).backgroundColor(0xAFEEEE).textAlign(TextAlign.Center).fontSize(20) + Text(item).width('90%').height(160).backgroundColor(0xAFEEEE).textAlign(TextAlign.Center).fontSize(30) }, item => item) } .cachedCount(2) .index(1) .autoPlay(true) .interval(4000) - .indicator(true) // 默认开启指示点 - .loop(false) // 默认开启循环播放 + .indicator(true) + .loop(true) .duration(1000) - .vertical(false) // 默认横向切换 .itemSpace(0) - .curve(Curve.Linear) // 动画曲线 + .curve(Curve.Linear) .onChange((index: number) => { console.info(index.toString()) }) - Flex({ justifyContent: FlexAlign.SpaceAround }) { - Button('next') + Row({ space: 12 }) { + Button('showNext') .onClick(() => { this.swiperController.showNext() }) - Button('preview') + Button('showPrevious') .onClick(() => { this.swiperController.showPrevious() }) - } - }.margin({ top: 5 }) + }.margin(5) + }.width('100%') + .margin({ top: 5 }) } } ``` - -![zh-cn_image_0000001224621917](figures/zh-cn_image_0000001224621917.gif) -- GitLab