From 4cde05deae974f023a8b9e5120a37862413067f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BF=E7=94=9F=E7=8B=AE=E5=AD=90?= Date: Mon, 18 Dec 2023 21:29:33 +0800 Subject: [PATCH] test: perf vxe-table example --- play/src/vxe-table.vue | 118 +++++++++++++++++------------------ play/src/vxe-table/index.vue | 77 +++++++++++++---------- 2 files changed, 102 insertions(+), 93 deletions(-) diff --git a/play/src/vxe-table.vue b/play/src/vxe-table.vue index 2849d58..43f5f1e 100644 --- a/play/src/vxe-table.vue +++ b/play/src/vxe-table.vue @@ -15,7 +15,7 @@ :enable="states.isVirtualScrollbar" :loading="states.isLoading" :tree-config="{transform: true}" - :column-config="{resizable: true}" + :column-config="{resizable: true }" :row-config="{isHover: true}" :checkbox-config="{labelField: 'id', highlight: true}" :data="states.tableData" @@ -27,79 +27,75 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + Upload - + Upload - + Upload - + Upload - + Upload - + Upload - + Upload - + Upload - + Upload - + Upload @@ -151,9 +147,13 @@ const getTableData = () => { parentId: null as number | null, name: 'Test-' + (count + 1), role: 'Develop', - sex: Math.random() < 0.5 ? '1' : '0', - age: 28, - address: Array(10).fill('long address long long long address').join(', ') + address: Array(10).fill('long address long long long address').join(', '), + // @ts-ignore + ...(Array.from({ length: 19 }).reduce((acc: any, _, idx) => { + acc[`sex${idx + 1}`] = Math.random() < 0.5 ? '1' : '0' + acc[`age${idx + 1}`] = Math.random() < 0.5 ? '1' : '0' + return acc + }, {} as Record)) } if (Math.random() < 0.5) { parentId = count @@ -193,7 +193,7 @@ const measure = (async () => { } const startTime = performance.now() - await NativeBird.mapSeries(Array.from({ length: 5 }), async (_, idx) => { + await NativeBird.mapSeries(Array.from({ length: 20 }), async (_, idx) => { await vxeTableRef.value.scrollTo(0, idx * 30) }) diff --git a/play/src/vxe-table/index.vue b/play/src/vxe-table/index.vue index 0d02e22..1f1d862 100644 --- a/play/src/vxe-table/index.vue +++ b/play/src/vxe-table/index.vue @@ -1,11 +1,6 @@