mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-12 04:13:13 +08:00
Improve code style
This commit is contained in:
parent
471743f4c7
commit
0670b05e50
@ -766,18 +766,13 @@ export default class Table extends React.Component {
|
||||
newColumn.key = this.getColumnKey(newColumn, i);
|
||||
return newColumn;
|
||||
});
|
||||
let emptyText;
|
||||
let emptyRowKey;
|
||||
|
||||
// Empty Data
|
||||
let emptyRowKey;
|
||||
if (!data || data.length === 0) {
|
||||
emptyText = (
|
||||
<div className="ant-table-placeholder">
|
||||
{locale.emptyText}
|
||||
</div>
|
||||
);
|
||||
columns.forEach((column, index) => {
|
||||
columns[index].render = () => ({
|
||||
children: !index ? emptyText : null,
|
||||
column.render = () => ({
|
||||
children: !index ? <div className="ant-table-placeholder">{locale.emptyText}</div> : null,
|
||||
props: {
|
||||
colSpan: !index ? columns.length : 0,
|
||||
},
|
||||
|
@ -11,9 +11,7 @@ import { Table } from 'antd';
|
||||
const columns = [{
|
||||
title: '姓名',
|
||||
dataIndex: 'name',
|
||||
render(text) {
|
||||
return <a href="#">{text}</a>;
|
||||
},
|
||||
render: (text) => <a href="#">{text}</a>,
|
||||
}, {
|
||||
title: '资产',
|
||||
className: 'column-money',
|
||||
@ -40,13 +38,15 @@ const data = [{
|
||||
address: '西湖区湖底公园1号',
|
||||
}];
|
||||
|
||||
ReactDOM.render(<Table
|
||||
columns={columns}
|
||||
dataSource={data}
|
||||
bordered
|
||||
title={() => '页头'}
|
||||
footer={() => '页脚'}
|
||||
/>, mountNode);
|
||||
ReactDOM.render(
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={data}
|
||||
bordered
|
||||
title={() => '页头'}
|
||||
footer={() => '页脚'}
|
||||
/>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
````css
|
||||
|
Loading…
Reference in New Issue
Block a user