Skip to content

Commit

Permalink
fix: 修改参数名称
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuyan committed Sep 18, 2023
1 parent d6df817 commit 89d5f66
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/lego/example/TableDemo/demo1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default () => {
data={data}
columns={columns}
height={120}
countPreview={4}
pageSize={4}
autoplay={true}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/lego/example/TableDemo/demo2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default () => {
data={data}
columns={columns}
height={200}
countPreview={4}
pageSize={4}
/>
</Modal>
</>
Expand Down
2 changes: 1 addition & 1 deletion packages/lego/example/TableDemo/demo3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default () => {
columns={columns}
colors={['red', 'blue', 'green']}
height={200}
countPreview={4}
pageSize={4}
/>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/lego/example/TableDemo/demo4.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,5 @@ const columns = [
];

export default () => {
return <Table data={data} columns={columns} height={210} countPreview={7} />;
return <Table data={data} columns={columns} height={210} pageSize={7} />;
};
2 changes: 1 addition & 1 deletion packages/lego/example/TableDemo/demo5.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default () => {
columns={columns}
autoplay={false}
height={200}
countPreview={4}
pageSize={4}
/>
);
};
2 changes: 1 addition & 1 deletion packages/lego/example/TableDemo/demo6.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default () => {
data={data}
columns={columns}
height={200}
countPreview={4}
pageSize={4}
autoplay={false}
headerClass="header"
contentClass="content"
Expand Down
2 changes: 1 addition & 1 deletion packages/lego/src/table/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ group:
| columns | `true` | 列数据 | `Column[]` | |
| data | `true` | 数据源 | `T[]` | |
| height | `true` | 除了表头的表格内容高度 | `number` | |
| countPreview | `true` | 每屏显示几条数据 | `number` | |
| pageSize | `true` | 每屏显示几条数据 | `number` | |
| speed | `false` | 速度(ms) | `number` | |
| autoplay | `false` | 自动轮播 | `boolean` | |
| inModal | `false` | 是否在弹窗中 | `boolean` | |
Expand Down
14 changes: 7 additions & 7 deletions packages/lego/src/table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export type CustomTableProps<T> = {
/** 容器高度 */
height: number;
/** 每屏显示几条数据 */
countPreview: number;
pageSize: number;
/** 速度(ms) */
speed?: number;
/** 自动轮播 */
Expand All @@ -49,7 +49,7 @@ function Table<T extends Record<string, any>>({
columns = [],
data = [],
height,
countPreview = 1,
pageSize = 1,
speed = 1000,
autoplay = true,
inModal = false,
Expand All @@ -67,7 +67,7 @@ function Table<T extends Record<string, any>>({
return { width };
};

const slidesPerViewParams = countPreview > data.length ? data.length : countPreview;
const slidesPerViewParams = pageSize > data.length ? data.length : pageSize;
const lineHeight = height / slidesPerViewParams;

return (
Expand Down Expand Up @@ -116,7 +116,7 @@ function Table<T extends Record<string, any>>({
<Container
{...{
height,
countPreview: slidesPerViewParams,
pageSize: slidesPerViewParams,
speed,
autoplay,
}}
Expand Down Expand Up @@ -165,21 +165,21 @@ function Table<T extends Record<string, any>>({
const Container = memo(
({
height,
countPreview,
pageSize,
autoplay,
speed,
children,
}: PropsWithChildren<{
height: number;
countPreview: number;
pageSize: number;
autoplay: boolean;
speed: number;
}>) => {
return (
<Swiper
direction={'vertical'}
modules={[Autoplay]}
slidesPerView={countPreview}
slidesPerView={pageSize}
spaceBetween={0}
loop
autoplay={
Expand Down

0 comments on commit 89d5f66

Please sign in to comment.