From 62249dc24806ecd36efe4ce7fe731a12a13e3b17 Mon Sep 17 00:00:00 2001 From: zhangwenshuai Date: Thu, 2 Jul 2020 19:27:15 +0800 Subject: [PATCH] update data- param --- components/apolloTable/component/Cell.tsx | 14 +++++++------- .../component/base/edit/container/index.tsx | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/components/apolloTable/component/Cell.tsx b/components/apolloTable/component/Cell.tsx index dac0dd8..ef9c81b 100644 --- a/components/apolloTable/component/Cell.tsx +++ b/components/apolloTable/component/Cell.tsx @@ -201,15 +201,15 @@ const Cell = (props: CellProps) => { // 获取当前节点的选中状态 const dom = cellUnit.current; let selected = false; - if (dom && dom.getAttribute('data-selectedCell')) { - selected = dom.getAttribute('data-selectedCell') === '1'; + if (dom && dom.getAttribute('data-selected-cell')) { + selected = dom.getAttribute('data-selected-cell') === '1'; } if (selected) { // 当前已选中,则进入编辑状态 setStatus('edit'); if (dom) { // 给当前dom添加编辑状态 - dom.setAttribute('data-editingCell', '1'); + dom.setAttribute('data-editing-cell', '1'); } } else { // 否则进入选中状态 @@ -218,12 +218,12 @@ const Cell = (props: CellProps) => { const doms = document.querySelectorAll('.cellUnit'); if (doms) { doms.forEach((item) => { - item.setAttribute('data-selectedCell', '0'); + item.setAttribute('data-selected-cell', '0'); item.classList.remove(s.selected); }); } // 给当前dom添加选中状态 - dom.setAttribute('data-selectedCell', '1'); + dom.setAttribute('data-selected-cell', '1'); // 给当前dom添加选中样式 dom.classList.add(s.selected); } @@ -346,8 +346,8 @@ const Cell = (props: CellProps) => { className={classNames('cellUnit', `row_${rowIndex}`, `col_${columnIndex}`, cellClassName)} style={cellStyle} id={`cellUnit_${rowIndex}_${columnIndex}`} - data-selectedCell="0" - data-editingCell="0" + data-selected-cell="0" + data-editing-cell="0" onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave} ref={cellUnit} diff --git a/components/apolloTable/component/base/edit/container/index.tsx b/components/apolloTable/component/base/edit/container/index.tsx index 3e4df61..7084e59 100644 --- a/components/apolloTable/component/base/edit/container/index.tsx +++ b/components/apolloTable/component/base/edit/container/index.tsx @@ -32,7 +32,7 @@ export default function CellContainer

(Comp) { onBlur = (e: any) => { let currTarget = e.target; while (currTarget != document) { - let editing = currTarget.getAttribute('data-editingCell'); + let editing = currTarget.getAttribute('data-editing-cell'); // 当前点击div是正在编辑的cell时,阻止修改回调 if (editing === '1') { return; @@ -48,7 +48,7 @@ export default function CellContainer

(Comp) { const doms = document.querySelectorAll('.cellUnit'); if (doms) { doms.forEach((item) => { - item.setAttribute('data-editingCell', '0'); + item.setAttribute('data-editing-cell', '0'); }); } } -- 2.21.0