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

update code style

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