Skip to content

Commit ab672b0

Browse files
committed
fix(Swiper): 移除 defaultCurrent 属性并调整导航器文档结构
1 parent 52c1a56 commit ab672b0

15 files changed

Lines changed: 478 additions & 2748 deletions

File tree

packages/products/tdesign-miniprogram/packages/components/swiper/README.en-US.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ pagination-position | String | bottom | options: top-left/top/top-right/bottom-l
2525
previous-margin | String / Number | 0 | `0.32.0` | N
2626
snap-to-edge | Boolean | false | `0.32.0` | N
2727

28-
### Swiper Slots
29-
30-
name | Description
31-
-- | --
32-
navigation | navigation all config, `true` for using default config。Typescript:`SwiperNavProps \| boolean`[SwiperNav API Documents](./swiper-nav?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/swiper/type.ts)
33-
3428
### Swiper Events
3529

3630
name | params | description
@@ -44,13 +38,7 @@ image-load | `(index: number)` | `1.1.4`
4438

4539
name | Description
4640
-- | --
47-
navigation | \-
48-
49-
### Swiper Slots
50-
51-
name | Description
52-
-- | --
53-
navigation | \-
41+
navigation | navigation all config, `true` for using default config。Typescript:`SwiperNavProps \| boolean`[SwiperNav API Documents](./swiper-nav?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/swiper/type.ts)
5442

5543
### Swiper External Classes
5644

packages/products/tdesign-miniprogram/packages/components/swiper/README.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ pagination-position | String | bottom | 页码信息展示位置。可选项:t
2525
previous-margin | String / Number | 0 | `0.32.0`。前边距,可用于露出前一项的一小部分。默认单位 `px` | N
2626
snap-to-edge | Boolean | false | `0.32.0`。当 swiper-item 的个数大于等于 2,关闭 circular 并且开启 previous-margin 或 next-margin 的时候,可以指定这个边距是否应用到第一个、最后一个元素 | N
2727

28-
### Swiper Slots
29-
30-
名称 | 描述
31-
-- | --
32-
navigation | 导航器全部配置,`true` 的话使用默认配置。TS 类型:`SwiperNavProps \| boolean`[SwiperNav API Documents](./swiper-nav?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/swiper/type.ts)
33-
3428
### Swiper Events
3529

3630
名称 | 参数 | 描述
@@ -44,13 +38,7 @@ image-load | `(index: number)` | `1.1.4`。图片加载时触发
4438

4539
名称 | 描述
4640
-- | --
47-
navigation | 导航器全部配置
48-
49-
### Swiper Slots
50-
51-
名称 | 描述
52-
-- | --
53-
navigation | 导航器全部配置
41+
navigation | 自定义 `navigation` 显示内容。TS 类型:`SwiperNavProps \| boolean`[SwiperNav API Documents](./swiper-nav?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/swiper/type.ts)
5442

5543
### Swiper External Classes
5644

packages/products/tdesign-mobile-react/src/swiper/defaultProps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { TdSwiperProps } from './type';
77
export const swiperDefaultProps: TdSwiperProps = {
88
animation: 'slide',
99
autoplay: true,
10-
defaultCurrent: 0,
10+
current: 0,
1111
direction: 'horizontal',
1212
duration: 300,
1313
interval: 5000,

packages/products/tdesign-mobile-react/src/swiper/swiper.en-US.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProper
1111
animation | String | slide | options: slide | N
1212
autoplay | Boolean | true | \- | N
1313
current | Number | 0 | \- | N
14-
defaultCurrent | Number | 0 | uncontrolled property | N
1514
direction | String | horizontal | options: horizontal/vertical | N
1615
duration | Number | 300 | \- | N
1716
height | String / Number | - | \- | N

packages/products/tdesign-mobile-react/src/swiper/swiper.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
1111
animation | String | slide | 轮播切换动画效果类型。可选项:slide | N
1212
autoplay | Boolean | true | 是否自动播放 | N
1313
current | Number | 0 | 当前轮播在哪一项(下标) | N
14-
defaultCurrent | Number | 0 | 当前轮播在哪一项(下标)。非受控属性 | N
1514
direction | String | horizontal | 轮播滑动方向,包括横向滑动和纵向滑动两个方向。可选项:horizontal/vertical | N
1615
duration | Number | 300 | 滑动动画时长 | N
1716
height | String / Number | - | 当使用垂直方向滚动时的高度 | N

packages/products/tdesign-mobile-vue/src/swiper/swiper.en-US.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ name | type | default | description | required
8181
animation | String | slide | options: slide | N
8282
autoplay | Boolean | true | \- | N
8383
current | Number | 0 | `v-model` and `v-model:current` is supported | N
84-
defaultCurrent | Number | 0 | uncontrolled property | N
8584
direction | String | horizontal | options: horizontal/vertical | N
8685
duration | Number | 300 | \- | N
8786
height | String / Number | - | \- | N
@@ -108,12 +107,3 @@ minShowNum | Number | - | \- | N
108107
paginationPosition | String | bottom | options: top-left/top/top-right/bottom-left/bottom/bottom-right/left/right | N
109108
showControls | Boolean | false | \- | N
110109
type | String | - | Typescript:`SwiperNavigationType` `type SwiperNavigationType = 'dots' \| 'dots-bar' \| 'fraction'`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/swiper/type.ts) | N
111-
112-
### SwiperNavigation
113-
114-
name | type | default | description | required
115-
-- | -- | -- | -- | --
116-
minShowNum | Number | - | \- | N
117-
paginationPosition | String | bottom | options: top-left/top/top-right/bottom-left/bottom/bottom-right/left/right | N
118-
showControls | Boolean | false | \- | N
119-
type | String | - | Typescript:`SwiperNavigationType` `type SwiperNavigationType = 'dots' \| 'dots-bar' \| 'fraction'`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/swiper/type.ts) | N

packages/products/tdesign-mobile-vue/src/swiper/swiper.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ type | String | - | 导航器类型,点状(dots)、点条状(dots-bar)、分
8181
animation | String | slide | 轮播切换动画效果类型。可选项:slide | N
8282
autoplay | Boolean | true | 是否自动播放 | N
8383
current | Number | 0 | 当前轮播在哪一项(下标)。支持语法糖 `v-model``v-model:current` | N
84-
defaultCurrent | Number | 0 | 当前轮播在哪一项(下标)。非受控属性 | N
8584
direction | String | horizontal | 轮播滑动方向,包括横向滑动和纵向滑动两个方向。可选项:horizontal/vertical | N
8685
duration | Number | 300 | 滑动动画时长 | N
8786
height | String / Number | - | 轮播的高度 | N
@@ -108,12 +107,3 @@ minShowNum | Number | - | 小于这个数字不会显示导航器 | N
108107
paginationPosition | String | bottom | 页码信息展示位置。可选项:top-left/top/top-right/bottom-left/bottom/bottom-right/left/right | N
109108
showControls | Boolean | false | 是否显示两侧的控制按钮 | N
110109
type | String | - | 导航器类型,点状(dots)、点条状(dots-bar)、分式(fraction)等。TS 类型:`SwiperNavigationType` `type SwiperNavigationType = 'dots' \| 'dots-bar' \| 'fraction'`[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/swiper/type.ts) | N
111-
112-
### SwiperNavigation
113-
114-
名称 | 类型 | 默认值 | 描述 | 必传
115-
-- | -- | -- | -- | --
116-
minShowNum | Number | - | 小于这个数字不会显示导航器 | N
117-
paginationPosition | String | bottom | 页码信息展示位置。可选项:top-left/top/top-right/bottom-left/bottom/bottom-right/left/right | N
118-
showControls | Boolean | false | 是否显示两侧的控制按钮 | N
119-
type | String | - | 导航器类型,点状(dots)、点条状(dots-bar)、分式(fraction)等。TS 类型:`SwiperNavigationType` `type SwiperNavigationType = 'dots' \| 'dots-bar' \| 'fraction'`[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/swiper/type.ts) | N
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/* eslint-disable */
2+
3+
/**
4+
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
5+
* */
6+
7+
import { TNode } from '../common';
8+
9+
export interface TdSwiperProps {
10+
/**
11+
* 轮播切换动画效果类型
12+
* @default slide
13+
*/
14+
animation?: 'slide';
15+
/**
16+
* 是否自动播放
17+
* @default true
18+
*/
19+
autoplay?: boolean;
20+
/**
21+
* 当前轮播在哪一项(下标)
22+
* @default 0
23+
*/
24+
current?: number;
25+
/**
26+
* 当前轮播在哪一项(下标),非受控属性
27+
* @default 0
28+
*/
29+
defaultCurrent?: number;
30+
/**
31+
* 当前轮播在哪一项(下标)
32+
* @default 0
33+
*/
34+
modelValue?: number;
35+
/**
36+
* 轮播滑动方向,包括横向滑动和纵向滑动两个方向
37+
* @default horizontal
38+
*/
39+
direction?: 'horizontal' | 'vertical';
40+
/**
41+
* 滑动动画时长
42+
* @default 300
43+
*/
44+
duration?: number;
45+
/**
46+
* 轮播的高度
47+
*/
48+
height?: string | number;
49+
/**
50+
* 轮播间隔时间
51+
* @default 5000
52+
*/
53+
interval?: number;
54+
/**
55+
* 是否循环播放
56+
* @default true
57+
*/
58+
loop?: boolean;
59+
/**
60+
* 导航器全部配置,`true` 的话使用默认配置
61+
* @default true
62+
*/
63+
navigation?: SwiperNavigation | TNode | Boolean;
64+
/**
65+
* 【开发中】后边距,可用于露出后一项的一小部分。默认单位 `px`
66+
* @default 0
67+
*/
68+
nextMargin?: string | number;
69+
/**
70+
* 【开发中】前边距,可用于露出前一项的一小部分。默认单位 `px`
71+
* @default 0
72+
*/
73+
previousMargin?: string | number;
74+
/**
75+
* 轮播切换时触发
76+
*/
77+
onChange?: (current: number, context: { source: SwiperChangeSource }) => void;
78+
/**
79+
* 点击轮播项时触发
80+
*/
81+
onClick?: (index: number) => void;
82+
}
83+
84+
export interface SwiperNavigation {
85+
/**
86+
* 小于这个数字不会显示导航器
87+
*/
88+
minShowNum?: number;
89+
/**
90+
* 页码信息展示位置
91+
* @default bottom
92+
*/
93+
paginationPosition?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right' | 'left' | 'right';
94+
/**
95+
* 是否显示两侧的控制按钮
96+
* @default false
97+
*/
98+
showControls?: boolean;
99+
/**
100+
* 导航器类型,点状(dots)、点条状(dots-bar)、分式(fraction)等
101+
* @default ''
102+
*/
103+
type?: SwiperNavigationType;
104+
}
105+
106+
export type SwiperChangeSource = 'autoplay' | 'touch' | 'nav';
107+
108+
export type SwiperNavigationType = 'dots' | 'dots-bar' | 'fraction';

packages/products/tdesign-react/packages/components/swiper/swiper.en-US.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ animation | String | slide | options: slide/fade | N
4444
autoplay | Boolean | true | \- | N
4545
cardScale | Number | 210/332 | \- | N
4646
current | Number | 0 | \- | N
47-
defaultCurrent | Number | 0 | uncontrolled property | N
4847
direction | String | horizontal | options: horizontal/vertical | N
4948
duration | Number | 300 | \- | N
5049
height | Number | - | \- | N

packages/products/tdesign-react/packages/components/swiper/swiper.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ animation | String | slide | 轮播切换动画效果类型:滑动、淡入淡
4444
autoplay | Boolean | true | 是否自动播放 | N
4545
cardScale | Number | 210/332 | 卡片模式下非当前展示轮播图的缩放比例 | N
4646
current | Number | 0 | 当前轮播在哪一项(下标) | N
47-
defaultCurrent | Number | 0 | 当前轮播在哪一项(下标)。非受控属性 | N
4847
direction | String | horizontal | 轮播滑动方向,包括横向滑动和纵向滑动两个方向。可选项:horizontal/vertical | N
4948
duration | Number | 300 | 滑动动画时长 | N
5049
height | Number | - | 当使用垂直方向滚动时的高度 | N

0 commit comments

Comments
 (0)