From a35efcd9acbcd069f6f2e84dfda8e926bed5f53a Mon Sep 17 00:00:00 2001 From: israelli Date: Mon, 13 May 2024 09:41:46 +0800 Subject: [PATCH] fix: shift + click stop user-select --- src/components/table/table-column.js | 4 ---- src/components/table/table-store.js | 3 --- src/components/table/use-shift-key.js | 2 ++ 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/components/table/table-column.js b/src/components/table/table-column.js index b2aac53..abffae8 100644 --- a/src/components/table/table-column.js +++ b/src/components/table/table-column.js @@ -116,10 +116,6 @@ const forced = { event.stopImmediatePropagation() if (disabled) return - const isShift = store.table.shiftMulti.isShift() - if (isShift) { - store.table.$el.style.setProperty('user-select', 'none') - } const result = await beforeChange() result !== false && store.commit('rowSelectedChanged', row, $index) diff --git a/src/components/table/table-store.js b/src/components/table/table-store.js index 3324af7..3da844f 100644 --- a/src/components/table/table-store.js +++ b/src/components/table/table-store.js @@ -424,9 +424,6 @@ class TableStore { states.selection.push(child) } }) - setTimeout(() => { - this.table.$el.style.setProperty('user-select', 'inherit') - }) } if (changed) { diff --git a/src/components/table/use-shift-key.js b/src/components/table/use-shift-key.js index 2addcd5..cc5d51d 100644 --- a/src/components/table/use-shift-key.js +++ b/src/components/table/use-shift-key.js @@ -34,12 +34,14 @@ export default (props) => { const handleKeyDown = (e) => { if (e.key === 'Shift') { isShiftKeyDown = true + document.body.style.userSelect = 'none' } } const handleKeyUp = (e) => { if (e.key === 'Shift') { isShiftKeyDown = false + document.body.style.userSelect = '' clearStore() } }