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