From 203d28c2608ef618c869dbe3ccadbe64c7736d62 Mon Sep 17 00:00:00 2001 From: smallchill Date: Thu, 24 Jan 2019 22:14:52 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Sword/Grid.js | 39 ++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/src/components/Sword/Grid.js b/src/components/Sword/Grid.js index 56bc9d5..aff6b9a 100644 --- a/src/components/Sword/Grid.js +++ b/src/components/Sword/Grid.js @@ -100,9 +100,8 @@ export default class Grid extends PureComponent { const selectKey = row[pkField] || row[childPkField]; if (`${selectKey}`.indexOf(',') > 0) { return `${selectKey}`.split(','); - } else { - return selectKey; } + return selectKey; }); }; @@ -199,9 +198,7 @@ export default class Grid extends PureComponent { } = this.props; let { columns } = this.props; - const actionButtons = buttons.filter(button => { - return button.action === 2 || button.action === 3; - }); + const actionButtons = buttons.filter(button => button.action === 2 || button.action === 3); if (columns && Array.isArray(columns) && actionButtons.length > 0) { const key = pkField || rowKey || 'id'; @@ -210,23 +207,21 @@ export default class Grid extends PureComponent { { title: formatMessage({ id: 'table.columns.action' }), width: actionColumnWidth || 200, - render: (text, record) => { - return ( - - {actionButtons.map((button, index) => ( - - {index > 0 ? : null} - this.handelClick(button, [record[childPkField || key]])} - > - - - - ))} - - ); - }, + render: (text, record) => ( + + {actionButtons.map((button, index) => ( + + {index > 0 ? : null} + this.handelClick(button, [record[childPkField || key]])} + > + + + + ))} + + ), }, ]; }