From cf719fb53ef4721a549e38999ca1fdb4e8b6d84f Mon Sep 17 00:00:00 2001 From: doom-9 <65016011+doom-9@users.noreply.github.com> Date: Sun, 13 Feb 2022 12:37:17 +0800 Subject: [PATCH] fix(virtual-list): keep alive reactivated (#137) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update VirtualList.ts * 格式化 * 滚动到记录位置 --- src/virtual-list/src/VirtualList.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/virtual-list/src/VirtualList.ts b/src/virtual-list/src/VirtualList.ts index be825fc..3fbe52a 100644 --- a/src/virtual-list/src/VirtualList.ts +++ b/src/virtual-list/src/VirtualList.ts @@ -8,7 +8,8 @@ import { ref, onMounted, h, - CSSProperties + CSSProperties, + onActivated } from 'vue' import { depx, pxfy, beforeNextFrameOnce } from 'seemly' import { useMemo } from 'vooks' @@ -124,6 +125,9 @@ export default defineComponent({ scrollTo({ key: defaultScrollKey }) } }) + onActivated(() => { + scrollTo({ top: scrollTopRef.value }) + }) const keyIndexMapRef = computed(() => { const map = new Map() const { keyField } = props