update code style

This commit is contained in:
afc163 2016-03-02 14:47:42 +08:00
parent e8ce54f864
commit 3738eb3b73
2 changed files with 8 additions and 16 deletions

View File

@ -9,19 +9,11 @@
````jsx
import { Table } from 'antd';
function renderAction() {
return <a href="#">删除</a>;
}
function expandedRowRender(record) {
return <p>{record.description}</p>;
}
const columns = [
{ title: '姓名', dataIndex: 'name', key: 'name' },
{ title: '年龄', dataIndex: 'age', key: 'age' },
{ title: '住址', dataIndex: 'address', key: 'address' },
{ title: '操作', dataIndex: '', key: 'x', render: renderAction }
{ title: '操作', dataIndex: '', key: 'x', render: () => <a href="#">删除</a> }
];
const data = [
@ -32,7 +24,7 @@ const data = [
ReactDOM.render(
<Table columns={columns}
expandedRowRender={expandedRowRender}
expandedRowRender={record => <p>{record.description}</p>}
dataSource={data}
className="table" />
, mountNode);

View File

@ -553,12 +553,12 @@ let AntTable = React.createClass({
},
render() {
let data = this.getCurrentPageData();
const data = this.getCurrentPageData();
let columns = this.renderRowSelection();
let expandIconAsCell = this.props.expandedRowRender && this.props.expandIconAsCell !== false;
let locale = objectAssign({}, defaultLocale, this.props.locale);
const expandIconAsCell = this.props.expandedRowRender && this.props.expandIconAsCell !== false;
const locale = objectAssign({}, defaultLocale, this.props.locale);
let classString = classNames({
const classString = classNames({
[`ant-table-${this.props.size}`]: true,
'ant-table-bordered': this.props.bordered,
[this.props.className]: !!this.props.className,
@ -595,10 +595,10 @@ let AntTable = React.createClass({
if (this.props.loading) {
// if there is no pagination or no data,
// 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-without-pagination';
let spinClassName = `${paginationPatchClass} ant-table-spin-holder`;
const spinClassName = `${paginationPatchClass} ant-table-spin-holder`;
table = <Spin className={spinClassName}>{table}</Spin>;
}
return (