Skip to content

Commit

Permalink
fix(VirtualList): 修复 Select 结合 VirtualList 时滚动到底部不正确的问题 (#904)
Browse files Browse the repository at this point in the history
* fix(VirtualList): 修复 Select 结合 VirtualList 时滚动到底部不正确的问题

* refactor: 解决执行 build:type 提示类型警告的问题
  • Loading branch information
ocean-gao authored Nov 4, 2024
1 parent 402fd64 commit 03836d0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion components/_util/popupManager.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { useSessionStorage } from '@vueuse/core';
import type { Ref } from 'vue';
import { getPrefixStorage } from '../_util/storage';

const PopupManager = {
const PopupManager: {
zIndex: Ref<number>;
nextZIndex: () => number;
} = {
zIndex: useSessionStorage<number>(getPrefixStorage('zIndex'), 2000),
nextZIndex() {
return ++PopupManager.zIndex.value;
Expand Down
3 changes: 2 additions & 1 deletion components/virtual-list/virtualList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export default defineComponent({
if (!virtual) {
return getClientSize();
}
return virtual.getTotalSize() + (props.dataSources.length - virtual.sizes.size) * virtual.getEstimateSize() + getClientSize();
void virtual.sizes.size;
return virtual.getTotalSize() + (props.dataSources.length - virtual.sizes.size) * virtual.getEstimateSize();
});

const getUniqueIdFromDataSources = () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/components/virtualList/vertical.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</div>
</template>
</FVirtualList>
<FButton @click="addMessage">添加消息{{ dataItems.length }}</FButton>
<FButton style="margin-top: 10px;" @click="addMessage">添加消息{{ dataItems.length }}</FButton>
</template>

<script>
Expand Down

0 comments on commit 03836d0

Please sign in to comment.