From b8ff876278d4cb0315a3c6cd7efb31e9f572292d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=98=89=E5=A8=81?= Date: Fri, 18 Nov 2022 11:25:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=BB=9A=E5=8A=A8=E6=8E=92=E5=90=8D?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=97=AE=E9=A2=98=E5=BD=93=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=87=8F=E5=B0=8F=E4=BA=8E=E7=AD=89=E4=BA=8E=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=95=B0=E6=97=B6=EF=BC=8C=E7=AC=AC=E4=B8=80=E6=9D=A1=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=BC=9A=E7=9B=B4=E6=8E=A5=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Tables/Tables/TableList/index.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/packages/components/Tables/Tables/TableList/index.vue b/src/packages/components/Tables/Tables/TableList/index.vue index 5fd3e02d..24324ec6 100644 --- a/src/packages/components/Tables/Tables/TableList/index.vue +++ b/src/packages/components/Tables/Tables/TableList/index.vue @@ -62,7 +62,7 @@ const status = reactive({ const calcRowsData = () => { let { dataset, rowNum, sort } = status.mergedConfig // @ts-ignore - sort && dataset.sort(({ value: a }, { value: b }) => { + sort &&dataset.sort(({ value: a }, { value: b } ) => { if (a > b) return -1 if (a < b) return 1 if (a === b) return 0 @@ -94,6 +94,7 @@ const calcHeights = (onresize = false) => { const { rowNum, dataset } = status.mergedConfig const avgHeight = h.value / rowNum status.avgHeight = avgHeight + if (!onresize) status.heights = new Array(dataset.length).fill(avgHeight) } @@ -131,12 +132,17 @@ const stopAnimation = () => { const onRestart = async () => { try { if (!status.mergedConfig) return + let { dataset, rowNum, sort } = status.mergedConfig stopAnimation() calcRowsData() - calcHeights(true) - animation(true) + let flag = true + if (dataset.length <= rowNum) { + flag=false + } + calcHeights(flag) + animation(flag) } catch (error) { - console.log(error) + console.error(error) } }