diff --git a/.changeset/curvy-shrimps-chew.md b/.changeset/curvy-shrimps-chew.md
new file mode 100644
index 0000000000..b7f0298596
--- /dev/null
+++ b/.changeset/curvy-shrimps-chew.md
@@ -0,0 +1,5 @@
+---
+'@td-design/lego': patch
+---
+
+修改table的lineHeight报错以及更新modal的写法
diff --git a/packages/lego/example/BarLineDemo/demo8.tsx b/packages/lego/example/BarLineDemo/demo8.tsx
index 286fb82e2e..f0879483da 100644
--- a/packages/lego/example/BarLineDemo/demo8.tsx
+++ b/packages/lego/example/BarLineDemo/demo8.tsx
@@ -8,7 +8,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
diff --git a/packages/lego/example/CircularSolidPieDemo/demo3.tsx b/packages/lego/example/CircularSolidPieDemo/demo3.tsx
index 7e9f1eba71..34ee023a63 100644
--- a/packages/lego/example/CircularSolidPieDemo/demo3.tsx
+++ b/packages/lego/example/CircularSolidPieDemo/demo3.tsx
@@ -16,7 +16,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
diff --git a/packages/lego/example/CuboidBarDemo/demo6.tsx b/packages/lego/example/CuboidBarDemo/demo6.tsx
index 4150ee2a64..1e2566c013 100644
--- a/packages/lego/example/CuboidBarDemo/demo6.tsx
+++ b/packages/lego/example/CuboidBarDemo/demo6.tsx
@@ -8,7 +8,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
diff --git a/packages/lego/example/CylinderBarDemo/demo5.tsx b/packages/lego/example/CylinderBarDemo/demo5.tsx
index c6b58757e8..da23249ea4 100644
--- a/packages/lego/example/CylinderBarDemo/demo5.tsx
+++ b/packages/lego/example/CylinderBarDemo/demo5.tsx
@@ -8,7 +8,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
diff --git a/packages/lego/example/CylinderShadowBarDemo/demo6.tsx b/packages/lego/example/CylinderShadowBarDemo/demo6.tsx
index 1435360d1e..70adb55702 100644
--- a/packages/lego/example/CylinderShadowBarDemo/demo6.tsx
+++ b/packages/lego/example/CylinderShadowBarDemo/demo6.tsx
@@ -8,7 +8,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
diff --git a/packages/lego/example/HorizontalBarDemo/demo5.tsx b/packages/lego/example/HorizontalBarDemo/demo5.tsx
index 494a055d7d..ee1a4a93e0 100644
--- a/packages/lego/example/HorizontalBarDemo/demo5.tsx
+++ b/packages/lego/example/HorizontalBarDemo/demo5.tsx
@@ -8,7 +8,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
diff --git a/packages/lego/example/ImgLineDemo/demo4.tsx b/packages/lego/example/ImgLineDemo/demo4.tsx
index 03810ab53f..836b228de6 100644
--- a/packages/lego/example/ImgLineDemo/demo4.tsx
+++ b/packages/lego/example/ImgLineDemo/demo4.tsx
@@ -8,7 +8,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
diff --git a/packages/lego/example/ModalDemo/demo1.tsx b/packages/lego/example/ModalDemo/demo1.tsx
index 01f738a3ce..d845a7ae94 100644
--- a/packages/lego/example/ModalDemo/demo1.tsx
+++ b/packages/lego/example/ModalDemo/demo1.tsx
@@ -9,7 +9,7 @@ export default () => {
return (
<>
- setVisible(false)} >
+ setVisible(false)} >
>
);
diff --git a/packages/lego/example/MultiHorizontalBarDemo/demo3.tsx b/packages/lego/example/MultiHorizontalBarDemo/demo3.tsx
index 09dfc8e1fe..67f023bb2c 100644
--- a/packages/lego/example/MultiHorizontalBarDemo/demo3.tsx
+++ b/packages/lego/example/MultiHorizontalBarDemo/demo3.tsx
@@ -8,7 +8,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
diff --git a/packages/lego/example/MultiLineDemo/demo8.tsx b/packages/lego/example/MultiLineDemo/demo8.tsx
index 2f46200eba..3936c5ee3e 100644
--- a/packages/lego/example/MultiLineDemo/demo8.tsx
+++ b/packages/lego/example/MultiLineDemo/demo8.tsx
@@ -8,7 +8,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
diff --git a/packages/lego/example/PictorialBarDemo/demo6.tsx b/packages/lego/example/PictorialBarDemo/demo6.tsx
index 261e7aa4fa..0276785d96 100644
--- a/packages/lego/example/PictorialBarDemo/demo6.tsx
+++ b/packages/lego/example/PictorialBarDemo/demo6.tsx
@@ -8,7 +8,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
diff --git a/packages/lego/example/ProgressDemo/demo2.tsx b/packages/lego/example/ProgressDemo/demo2.tsx
index cc3bcd98b5..4137b88d0d 100644
--- a/packages/lego/example/ProgressDemo/demo2.tsx
+++ b/packages/lego/example/ProgressDemo/demo2.tsx
@@ -8,7 +8,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
diff --git a/packages/lego/example/RadarDemo/demo2.tsx b/packages/lego/example/RadarDemo/demo2.tsx
index aea34258f7..8b484542aa 100644
--- a/packages/lego/example/RadarDemo/demo2.tsx
+++ b/packages/lego/example/RadarDemo/demo2.tsx
@@ -28,7 +28,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
diff --git a/packages/lego/example/ScatterDemo/demo4.tsx b/packages/lego/example/ScatterDemo/demo4.tsx
index 7bc6d56bd8..91b2c54eb7 100644
--- a/packages/lego/example/ScatterDemo/demo4.tsx
+++ b/packages/lego/example/ScatterDemo/demo4.tsx
@@ -8,7 +8,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
diff --git a/packages/lego/example/SliceBarDemo/demo5.tsx b/packages/lego/example/SliceBarDemo/demo5.tsx
index b15da217a7..829afc3bab 100644
--- a/packages/lego/example/SliceBarDemo/demo5.tsx
+++ b/packages/lego/example/SliceBarDemo/demo5.tsx
@@ -8,7 +8,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
diff --git a/packages/lego/example/StackBarDemo/demo5.tsx b/packages/lego/example/StackBarDemo/demo5.tsx
index aa573048e2..36767e6df4 100644
--- a/packages/lego/example/StackBarDemo/demo5.tsx
+++ b/packages/lego/example/StackBarDemo/demo5.tsx
@@ -8,7 +8,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
diff --git a/packages/lego/example/TableDemo/demo1.tsx b/packages/lego/example/TableDemo/demo1.tsx
index f68d1e826d..3f713a1604 100644
--- a/packages/lego/example/TableDemo/demo1.tsx
+++ b/packages/lego/example/TableDemo/demo1.tsx
@@ -61,7 +61,7 @@ export default () => {
data={data}
columns={columns}
height={200}
- countPerview={6}
+ countPreview={6}
autoplay={true}
/>
);
diff --git a/packages/lego/example/TableDemo/demo2.tsx b/packages/lego/example/TableDemo/demo2.tsx
index 94978653eb..c38f81eeff 100644
--- a/packages/lego/example/TableDemo/demo2.tsx
+++ b/packages/lego/example/TableDemo/demo2.tsx
@@ -63,7 +63,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
@@ -74,7 +74,7 @@ export default () => {
data={data}
columns={columns}
height={200}
- countPerview={4}
+ countPreview={4}
/>
>
diff --git a/packages/lego/example/TableDemo/demo3.tsx b/packages/lego/example/TableDemo/demo3.tsx
index 14f20ee5ee..8122972753 100644
--- a/packages/lego/example/TableDemo/demo3.tsx
+++ b/packages/lego/example/TableDemo/demo3.tsx
@@ -63,7 +63,7 @@ export default () => {
columns={columns}
colors={['red', 'blue', 'green']}
height={200}
- countPerview={4}
+ countPreview={4}
/>
>
);
diff --git a/packages/lego/example/TableDemo/demo4.tsx b/packages/lego/example/TableDemo/demo4.tsx
index 91d591fa22..1c9aaecb31 100644
--- a/packages/lego/example/TableDemo/demo4.tsx
+++ b/packages/lego/example/TableDemo/demo4.tsx
@@ -104,5 +104,5 @@ const columns = [
];
export default () => {
- return ;
+ return ;
};
diff --git a/packages/lego/example/TableDemo/demo5.tsx b/packages/lego/example/TableDemo/demo5.tsx
index e407a44dcb..4d2a9aefb9 100644
--- a/packages/lego/example/TableDemo/demo5.tsx
+++ b/packages/lego/example/TableDemo/demo5.tsx
@@ -98,7 +98,7 @@ export default () => {
columns={columns}
autoplay={false}
height={200}
- countPerview={4}
+ countPreview={4}
/>
);
};
diff --git a/packages/lego/example/TableDemo/demo6.tsx b/packages/lego/example/TableDemo/demo6.tsx
index 524495d471..78577fe42d 100644
--- a/packages/lego/example/TableDemo/demo6.tsx
+++ b/packages/lego/example/TableDemo/demo6.tsx
@@ -107,7 +107,7 @@ export default () => {
data={data}
columns={columns}
height={200}
- countPerview={4}
+ countPreview={4}
autoplay={false}
headerClass="header"
contentClass="content"
diff --git a/packages/lego/example/TextScrollDemo/demo3.tsx b/packages/lego/example/TextScrollDemo/demo3.tsx
index af0545eba4..767f3662b5 100644
--- a/packages/lego/example/TextScrollDemo/demo3.tsx
+++ b/packages/lego/example/TextScrollDemo/demo3.tsx
@@ -8,7 +8,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={650}
diff --git a/packages/lego/example/ThreeDimensionalPieDemo/demo3.tsx b/packages/lego/example/ThreeDimensionalPieDemo/demo3.tsx
index 50071898a2..459ee1f91d 100644
--- a/packages/lego/example/ThreeDimensionalPieDemo/demo3.tsx
+++ b/packages/lego/example/ThreeDimensionalPieDemo/demo3.tsx
@@ -15,7 +15,7 @@ export default () => {
<>
setVisible(false)}
footer={null}
width={750}
diff --git a/packages/lego/src/table/index.md b/packages/lego/src/table/index.md
index ea7baf06a7..2ca8c8c2e8 100644
--- a/packages/lego/src/table/index.md
+++ b/packages/lego/src/table/index.md
@@ -7,7 +7,7 @@ group:
title: 其他
---
-# 轮播图
+# 表格
## API
diff --git a/packages/lego/src/table/index.tsx b/packages/lego/src/table/index.tsx
index c0aed907cb..0325fa8094 100644
--- a/packages/lego/src/table/index.tsx
+++ b/packages/lego/src/table/index.tsx
@@ -30,7 +30,7 @@ export type CustomTableProps = {
/** 容器高度 */
height: number;
/** 每屏显示几条数据 */
- countPerview: number;
+ countPreview: number;
/** 速度(ms) */
speed?: number;
/** 自动轮播 */
@@ -49,7 +49,7 @@ function Table>({
columns = [],
data = [],
height,
- countPerview,
+ countPreview = 1,
speed = 1000,
autoplay = true,
inModal = false,
@@ -67,7 +67,7 @@ function Table>({
return { width };
};
- const slidesPerViewParams = countPerview > data.length ? data.length : countPerview;
+ const slidesPerViewParams = countPreview > data?.length ?? 0 ? countPreview : data.length;
const lineHeight = height / slidesPerViewParams;
return (
@@ -116,7 +116,7 @@ function Table>({
>({
const Container = memo(
({
height,
- countPerview,
+ countPreview,
autoplay,
speed,
children,
}: PropsWithChildren<{
height: number;
- countPerview: number;
+ countPreview: number;
autoplay: boolean;
speed: number;
}>) => {
@@ -179,7 +179,7 @@ const Container = memo(