-
-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add header table * feat: add header table * feat: test * feat: add createTable * feat: add data * feat: test * feat: 精简代码
- Loading branch information
Showing
5 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: components | ||
nav: | ||
title: Demo | ||
path: /demo | ||
--- | ||
|
||
<code src="../examples/components.tsx"></code> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react'; | ||
import Table from 'rc-table'; | ||
|
||
const data = []; | ||
for (let i = 0; i < 100; i += 1) { | ||
data.push({ | ||
key: i, | ||
a: `a${i}`, | ||
b: `b${i}`, | ||
c: `c${i}`, | ||
}); | ||
} | ||
|
||
const table = (props: any) => { | ||
return ( | ||
<> | ||
<div style={{ background: '#fff' }}>header table</div> | ||
<table className={props.className}>{props.children}</table> | ||
</> | ||
); | ||
}; | ||
|
||
const Demo = () => { | ||
return ( | ||
<div> | ||
<Table | ||
components={{ header: { table } }} | ||
sticky | ||
columns={[ | ||
{ title: 'title1', dataIndex: 'a', key: 'a', width: 100 }, | ||
{ title: 'title2', dataIndex: 'b', key: 'b', width: 100 }, | ||
{ title: 'title3', dataIndex: 'c', key: 'c', width: 200 }, | ||
]} | ||
data={data} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Demo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters