From a17edb45fddf470ac6ba789387113a87c119e1b5 Mon Sep 17 00:00:00 2001 From: zhangjingwei Date: Mon, 17 Oct 2022 16:24:56 +0800 Subject: [PATCH] fix: fix the row auto selected when copy id Fix theselected state of the row changed when the id in the row is copied, check the click event target, if the target is the copy button, then stop propagation. Change-Id: I3bc2cd0802d2f7dd08a34c9628d282c9c1a09dd4 --- src/utils/table.jsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/utils/table.jsx b/src/utils/table.jsx index 3055ce89..90547c9f 100644 --- a/src/utils/table.jsx +++ b/src/utils/table.jsx @@ -169,10 +169,22 @@ export const getIdRender = (value, copyable = true, isLink = true) => { if (!copyable) { return shortRender; } + const onClick = (e) => { + if (e) { + const { nodeName = '', className = '' } = e.target || {}; + const isCopyClick = + nodeName === 'svg' || + (isString(className) && className.includes('copy')); + if (isCopyClick && e.stopPropagation) { + return e.stopPropagation(); + } + } + }; return ( {shortRender}