提交 3738eb3b 编写于 作者: A afc163

update code style

上级 e8ce54f8
...@@ -9,19 +9,11 @@ ...@@ -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 = [ ...@@ -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({ ...@@ -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({ ...@@ -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 (
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册