From 8eab365e1d1e7678a4dc968ecc61f6afb2584762 Mon Sep 17 00:00:00 2001 From: qdzhaoxiaodao <1132468176@qq.com> Date: Sun, 10 Jul 2022 22:02:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8F=AF=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E8=A1=8Ctable=E7=BB=84=E4=BB=B6=EF=BC=8Cdata=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E6=95=B0=E6=8D=AE=E6=97=B6=EF=BC=8C=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=85=A8=E9=80=89=E6=8C=89=E9=92=AE=E4=BC=9A=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复可选中行table组件,data为空数据时,默认全选按钮会选中的问题 --- src/table/hooks/useRowSelect.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/table/hooks/useRowSelect.tsx b/src/table/hooks/useRowSelect.tsx index ca8361b65..08a503f90 100644 --- a/src/table/hooks/useRowSelect.tsx +++ b/src/table/hooks/useRowSelect.tsx @@ -65,12 +65,14 @@ export default function useRowSelect(props: TdPrimaryTableProps) { // eslint-disable-next-line function getSelectedHeader(h: CreateElement) { + const isIndeterminate = intersectionKeys.value.length > 0 && intersectionKeys.value.length < canSelectedRows.value.length; + const isChecked = intersectionKeys.value.length !== 0 + && canSelectedRows.value.length !== 0 + && intersectionKeys.value.length === canSelectedRows.value.length; return () => ( 0 && intersectionKeys.value.length < canSelectedRows.value.length - } + checked={isChecked} + indeterminate={isIndeterminate} disabled={!canSelectedRows.value.length} {...{ on: { change: handleSelectAll } }} />