Skip to content

Commit e75621e

Browse files
committed
docs: update demo
1 parent e350775 commit e75621e

File tree

4 files changed

+90
-136
lines changed

4 files changed

+90
-136
lines changed

packages/components/table/_example/fixed-column.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useRef, useState } from 'react';
2-
import { Table, Radio, Checkbox, Space, Tag, Link } from 'tdesign-react';
3-
import { ErrorCircleFilledIcon, CheckCircleFilledIcon, CloseCircleFilledIcon } from 'tdesign-icons-react';
2+
import { Button, Checkbox, Link, Radio, Space, Table, Tag } from 'tdesign-react';
3+
import { CheckCircleFilledIcon, CloseCircleFilledIcon, ErrorCircleFilledIcon } from 'tdesign-icons-react';
44

55
import type { TableProps } from 'tdesign-react';
66

@@ -33,7 +33,7 @@ export default function TableFixedColumn() {
3333
const [rightFixedColumn, setReftFixedColumn] = useState(1);
3434

3535
const tableRef = useRef(null);
36-
// eslint-disable-next-line
36+
3737
const scrollToCreateTime = () => {
3838
// 横向滚动到指定列,一般用于列数量较多的场景
3939
tableRef.current.scrollColumnIntoView('createTime');
@@ -42,6 +42,7 @@ export default function TableFixedColumn() {
4242
const table = (
4343
<Table
4444
ref={tableRef}
45+
style={{ maxWidth: '800px' }}
4546
bordered
4647
rowKey="index"
4748
data={emptyData ? [] : data}
@@ -101,7 +102,7 @@ export default function TableFixedColumn() {
101102
<Radio.Button value={2}>右侧固定两列</Radio.Button>
102103
</Radio.Group>
103104

104-
<div>
105+
<Space align="center">
105106
<Radio.Group
106107
value={tableLayout}
107108
variant="default-filled"
@@ -110,10 +111,13 @@ export default function TableFixedColumn() {
110111
<Radio.Button value="fixed">table-layout: fixed</Radio.Button>
111112
<Radio.Button value="auto">table-layout: auto</Radio.Button>
112113
</Radio.Group>
113-
<Checkbox value={emptyData} onChange={setEmptyData} style={{ marginLeft: '16px', verticalAlign: 'middle' }}>
114+
<Button onClick={scrollToCreateTime} variant="dashed">
115+
滚动到指定列
116+
</Button>
117+
<Checkbox value={emptyData} onChange={setEmptyData}>
114118
空数据
115119
</Checkbox>
116-
</div>
120+
</Space>
117121

118122
{table}
119123
</Space>

packages/components/table/_example/fixed-header-col.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ for (let i = 0; i < 20; i++) {
1919
index: i,
2020
applicant: ['贾明', '张三', '王芳'][i % 3],
2121
status: i % 3,
22-
channel: ['电子签署', '纸质签署', '纸质签署'][i % 3],
2322
detail: {
2423
2524
},
@@ -65,7 +64,6 @@ export default function TableFixedColumn() {
6564
);
6665
},
6766
},
68-
{ colKey: 'channel', title: '签署方式' },
6967
{ colKey: 'matters', title: '申请事项', width: '150', foot: '-' },
7068
{ colKey: 'detail.email', title: '邮箱地址' },
7169
{ colKey: 'createTime', title: '申请日期', width: '120', foot: '-' },

0 commit comments

Comments
 (0)