From f53eb7d2e66a9412471336182466658a2771384e Mon Sep 17 00:00:00 2001 From: yuyangvi Date: Mon, 6 Mar 2017 15:05:40 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 可以自定义表格td的样式,根据value的值显示不同的效果 --- src/TableCell.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/TableCell.jsx b/src/TableCell.jsx index 846b13370..abfe4f877 100644 --- a/src/TableCell.jsx +++ b/src/TableCell.jsx @@ -42,6 +42,7 @@ export default class TableCell extends React.Component { let tdProps; let colSpan; let rowSpan; + let style; if (render) { text = render(text, record, index); @@ -49,6 +50,7 @@ export default class TableCell extends React.Component { tdProps = text.props || {}; rowSpan = tdProps.rowSpan; colSpan = tdProps.colSpan; + style = tdProps.style; text = text.children; } } @@ -73,6 +75,7 @@ export default class TableCell extends React.Component { colSpan={colSpan} rowSpan={rowSpan} className={className} + style={style} onClick={this.handleClick} > {indentText} From 747cbe24b90635827592b3b0a88272b2a121d499 Mon Sep 17 00:00:00 2001 From: yuyangvi Date: Mon, 6 Mar 2017 21:21:52 +0800 Subject: [PATCH 2/3] pass the whole tdProps pass the whole tdProps, expecially rowSpan, colSpan, style, className, etc. --- src/TableCell.jsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/TableCell.jsx b/src/TableCell.jsx index abfe4f877..f3873f21d 100644 --- a/src/TableCell.jsx +++ b/src/TableCell.jsx @@ -48,9 +48,6 @@ export default class TableCell extends React.Component { text = render(text, record, index); if (this.isInvalidRenderCellText(text)) { tdProps = text.props || {}; - rowSpan = tdProps.rowSpan; - colSpan = tdProps.colSpan; - style = tdProps.style; text = text.children; } } @@ -72,10 +69,8 @@ export default class TableCell extends React.Component { } return ( {indentText} From 77d143a956e6af0aee199ef074f9d2b3c005101a Mon Sep 17 00:00:00 2001 From: yuyangvi Date: Tue, 7 Mar 2017 13:16:18 +0800 Subject: [PATCH 3/3] test review --- src/TableCell.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TableCell.jsx b/src/TableCell.jsx index f3873f21d..f9503de82 100644 --- a/src/TableCell.jsx +++ b/src/TableCell.jsx @@ -42,12 +42,13 @@ export default class TableCell extends React.Component { let tdProps; let colSpan; let rowSpan; - let style; if (render) { text = render(text, record, index); if (this.isInvalidRenderCellText(text)) { tdProps = text.props || {}; + colSpan = tdProps.colSpan; + rowSpan = tdProps.rowSpan; text = text.children; } }