mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 11:40:04 +08:00
update code style
This commit is contained in:
parent
e8ce54f864
commit
3738eb3b73
@ -9,19 +9,11 @@
|
|||||||
````jsx
|
````jsx
|
||||||
import { Table } from 'antd';
|
import { Table } from 'antd';
|
||||||
|
|
||||||
function renderAction() {
|
|
||||||
return <a href="#">删除</a>;
|
|
||||||
}
|
|
||||||
|
|
||||||
function expandedRowRender(record) {
|
|
||||||
return <p>{record.description}</p>;
|
|
||||||
}
|
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{ title: '姓名', dataIndex: 'name', key: 'name' },
|
{ title: '姓名', dataIndex: 'name', key: 'name' },
|
||||||
{ title: '年龄', dataIndex: 'age', key: 'age' },
|
{ title: '年龄', dataIndex: 'age', key: 'age' },
|
||||||
{ title: '住址', dataIndex: 'address', key: 'address' },
|
{ title: '住址', dataIndex: 'address', key: 'address' },
|
||||||
{ title: '操作', dataIndex: '', key: 'x', render: renderAction }
|
{ title: '操作', dataIndex: '', key: 'x', render: () => <a href="#">删除</a> }
|
||||||
];
|
];
|
||||||
|
|
||||||
const data = [
|
const data = [
|
||||||
@ -32,7 +24,7 @@ const data = [
|
|||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<Table columns={columns}
|
<Table columns={columns}
|
||||||
expandedRowRender={expandedRowRender}
|
expandedRowRender={record => <p>{record.description}</p>}
|
||||||
dataSource={data}
|
dataSource={data}
|
||||||
className="table" />
|
className="table" />
|
||||||
, mountNode);
|
, mountNode);
|
||||||
|
@ -553,12 +553,12 @@ let AntTable = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let data = this.getCurrentPageData();
|
const data = this.getCurrentPageData();
|
||||||
let columns = this.renderRowSelection();
|
let columns = this.renderRowSelection();
|
||||||
let expandIconAsCell = this.props.expandedRowRender && this.props.expandIconAsCell !== false;
|
const expandIconAsCell = this.props.expandedRowRender && this.props.expandIconAsCell !== false;
|
||||||
let locale = objectAssign({}, defaultLocale, this.props.locale);
|
const locale = objectAssign({}, defaultLocale, this.props.locale);
|
||||||
|
|
||||||
let classString = classNames({
|
const classString = classNames({
|
||||||
[`ant-table-${this.props.size}`]: true,
|
[`ant-table-${this.props.size}`]: true,
|
||||||
'ant-table-bordered': this.props.bordered,
|
'ant-table-bordered': this.props.bordered,
|
||||||
[this.props.className]: !!this.props.className,
|
[this.props.className]: !!this.props.className,
|
||||||
@ -595,10 +595,10 @@ let AntTable = React.createClass({
|
|||||||
if (this.props.loading) {
|
if (this.props.loading) {
|
||||||
// if there is no pagination or no data,
|
// if there is no pagination or no data,
|
||||||
// the height of spin should decrease by half of pagination
|
// the height of spin should decrease by half of pagination
|
||||||
let paginationPatchClass = (this.hasPagination() && data && data.length !== 0)
|
const paginationPatchClass = (this.hasPagination() && data && data.length !== 0)
|
||||||
? 'ant-table-with-pagination'
|
? 'ant-table-with-pagination'
|
||||||
: 'ant-table-without-pagination';
|
: 'ant-table-without-pagination';
|
||||||
let spinClassName = `${paginationPatchClass} ant-table-spin-holder`;
|
const spinClassName = `${paginationPatchClass} ant-table-spin-holder`;
|
||||||
table = <Spin className={spinClassName}>{table}</Spin>;
|
table = <Spin className={spinClassName}>{table}</Spin>;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user