From 9ef865e25e44f61f76e36ab3d52073b43cd76cde Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Fri, 25 Dec 2015 15:46:15 +0800 Subject: [PATCH] docs: update demo and documentation --- components/table/demo/indent-size.md | 84 ++++++++++++++++++++++++++++ components/table/index.md | 1 + 2 files changed, 85 insertions(+) create mode 100644 components/table/demo/indent-size.md diff --git a/components/table/demo/indent-size.md b/components/table/demo/indent-size.md new file mode 100644 index 0000000000..5484eb8b34 --- /dev/null +++ b/components/table/demo/indent-size.md @@ -0,0 +1,84 @@ +# 树形数据展示 + +- order: 16 + +表格支持树形数据的展示,可以通过设置 `indentSize` 以控制每一层的缩进宽度。 + +--- + +````jsx +import { Table } from 'antd'; + +const columns = [{ + title: '姓名', + dataIndex: 'name', + key: 'name', + width: '40%', +}, { + title: '年龄', + dataIndex: 'age', + key: 'age', + width: '30%', +}, { + title: '住址', + dataIndex: 'address', + key: 'address', + width: '30%', +}]; + +const data = [{ + key: 1, + name: 'a', + age: 32, + address: '我是a', + children: [{ + key: 11, + name: 'aa', + age: 33, + address: '我是aa', + }, { + key: 12, + name: 'ab', + age: 33, + address: '我是ab', + children: [{ + key: 121, + name: 'aba', + age: 33, + address: '我是aba', + }], + }, { + key: 13, + name: 'ac', + age: 33, + address: '我是ac', + children: [{ + key: 131, + name: 'aca', + age: 33, + address: '我是aca', + children: [{ + key: 1311, + name: 'acaa', + age: 33, + address: '我是acaa', + }, { + key: 1312, + name: 'acab', + age: 33, + address: '我是acab', + }], + }], + }], +}, { + key: 2, + name: 'b', + age: 32, + address: '我是b', +}]; + +ReactDOM.render( + , + document.getElementById('components-table-demo-indent-size') +); +```` diff --git a/components/table/index.md b/components/table/index.md index c578442f24..c186449016 100644 --- a/components/table/index.md +++ b/components/table/index.md @@ -83,6 +83,7 @@ const columns = [{ | filterMultiple | 是否多选 | Boolean | | true | | sorter | 排序函数,本地排序使用一个函数,需要服务端排序可设为 true | Function or Boolean | | 无 | | colSpan | 表头列合并,设置为 0 时,不渲染 | Number | | | +| indentSize | 展示树形数据时,每层缩进的宽度,以 px 为单位 | Number | | 15 | | width | 列宽度 | String or Number | | 无 | | className | 列的 className | String | | 无 |