From b7b4e2f8a304830231de506074d33cfc201bbc9b Mon Sep 17 00:00:00 2001 From: huayj Date: Sat, 24 Aug 2019 15:37:12 +0800 Subject: [PATCH] =?UTF-8?q?column=E6=96=B0=E5=A2=9E`titleAlign`=E5=92=8C`c?= =?UTF-8?q?ontentAlign`=E5=B1=9E=E6=80=A7,=E6=8E=A7=E5=88=B6=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E5=92=8C=E5=86=85=E5=AE=B9=E7=9A=84=E5=B1=85=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Table.js | 3 ++- src/TableCell.js | 5 ++++- src/TableHeader.js | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Table.js b/src/Table.js index f76928e..de9b807 100644 --- a/src/Table.js +++ b/src/Table.js @@ -480,7 +480,8 @@ class Table extends Component { fixed: column.fixed, width: width, dataindex:column.dataIndex, - textAlign:column.textAlign + textAlign:column.textAlign, + titleAlign: column.titleAlign, // 标题水平对齐方式 }; if (column.onHeadCellClick) { cell.onClick = column.onHeadCellClick; diff --git a/src/TableCell.js b/src/TableCell.js index ef4e628..332ed3e 100644 --- a/src/TableCell.js +++ b/src/TableCell.js @@ -125,7 +125,10 @@ class TableCell extends Component{ if(column.fixed && !fixed){ className = className+` ${clsPrefix}-fixed-columns-in-body`; } - if(column.textAlign){ + if(column.contentAlign){ + className = className+` text-${column.contentAlign}`; + } + else if(column.textAlign){ className = className+` text-${column.textAlign}`; } if(typeof text == 'string' && bodyDisplayInRow){ diff --git a/src/TableHeader.js b/src/TableHeader.js index 2b75b8d..2fa66f7 100644 --- a/src/TableHeader.js +++ b/src/TableHeader.js @@ -745,10 +745,15 @@ class TableHeader extends Component { canDotDrag = "th-can-not-drag"; } let thClassName = `${da.className}`?`${da.className}`:''; - if(da.textAlign){ + if(da.titleAlign){ + thClassName += ` text-${da.titleAlign} `; + } + else if(da.textAlign){ thClassName += ` text-${da.textAlign} `; } + delete da.textAlign; + delete da.titleAlign; const keyTemp = {}; //避免key为undefined // if(da.dataindex && da.key ===undefined ){