From 6c0c542a8c07993e5022bb64359deede9087fad5 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 18:58:26 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 + play/src/vxe-table.vue | 105 ++++++++++++++++++++++++++++-- play/src/vxe-table/hooks/index.ts | 21 ++++++ play/src/vxe-table/index.vue | 98 ++++++++++++++++++++++++---- pnpm-lock.yaml | 23 +++++-- 5 files changed, 223 insertions(+), 26 deletions(-) create mode 100644 play/src/vxe-table/hooks/index.ts diff --git a/package.json b/package.json index cb701db..b2deb0a 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "vue-demi": "^0.14.6" }, "devDependencies": { + "@element-plus/icons-vue": "^2.3.1", "@commitlint/cli": "^17.8.1", "@commitlint/config-conventional": "^17.8.1", "@types/node": "^17.0.45", @@ -48,6 +49,7 @@ "less": "^4.2.0", "lint-staged": "^13.3.0", "mitt": "^3.0.1", + "nativebird": "^1.2.11", "overlayscrollbars": "^2.4.4", "overlayscrollbars-vue": "^0.5.6", "postcss": "^8.4.31", diff --git a/play/src/vxe-table.vue b/play/src/vxe-table.vue index 797d5b4..2849d58 100644 --- a/play/src/vxe-table.vue +++ b/play/src/vxe-table.vue @@ -4,10 +4,12 @@

## VXETable with Virtual Scrollbars {{ isHover ? ' - Hovered' : '' }}

表格虚拟滚动 表格虚拟滚动条 + 测试滚动性能 刷新 +{{ listCount }}条数据 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + Upload + + + Upload + + + Upload + + + Upload + + + Upload + + + Upload + + + Upload + + + Upload + + + Upload + + + Upload + + diff --git a/play/src/vxe-table/hooks/index.ts b/play/src/vxe-table/hooks/index.ts new file mode 100644 index 0000000..10602bd --- /dev/null +++ b/play/src/vxe-table/hooks/index.ts @@ -0,0 +1,21 @@ +/** + * 将 promise 转化为延迟调用,以便控制其流程 + */ +export function useDefer() { + let resolve: (value: T | PromiseLike) => void; + let reject: (reason?: any) => void; + + const promise = new Promise((_resolve, _reject) => { + resolve = _resolve; + reject = _reject; + }); + + const states = Object.freeze({ + promise, + then: promise.then.bind(promise), + resolve: resolve!, + reject: reject!, + }); + + return states; +} diff --git a/play/src/vxe-table/index.vue b/play/src/vxe-table/index.vue index 4994905..0d02e22 100644 --- a/play/src/vxe-table/index.vue +++ b/play/src/vxe-table/index.vue @@ -6,7 +6,7 @@ barStates.isScrolling.y ? 'is-scrolling-y' : '', (!barStates.isScrolling.x && !barStates.isScrolling.y) ? 'is-no-scrolling' : '', ]" - ref="tableRef" + ref="vxeTableRef" height="100%" v-bind="$attrs" > @@ -15,30 +15,96 @@