mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-01 11:38:36 +08:00
fix: select scroll height not correct #3419
This commit is contained in:
parent
4f9555c64a
commit
aea25100e5
@ -1 +1 @@
|
||||
Subproject commit db458a2276cd9156a7824f4e876de5702efd9ff7
|
||||
Subproject commit 8269bbdf109ab684626cd8ef0c4fc5f0c2222210
|
@ -133,7 +133,7 @@ const List = defineComponent({
|
||||
}
|
||||
|
||||
// ================================ Height ================================
|
||||
const [setInstance, collectHeight, heights, heightUpdatedMark] = useHeights(getKey, null, null);
|
||||
const [setInstance, collectHeight, heights] = useHeights(getKey, null, null);
|
||||
// ========================== Visible Calculation =========================
|
||||
const calRes = computed(() => {
|
||||
if (!useVirtual.value) {
|
||||
@ -194,7 +194,6 @@ const List = defineComponent({
|
||||
// Give cache to improve scroll experience
|
||||
endIndex = Math.min(endIndex + 1, state.mergedData.length);
|
||||
return {
|
||||
heightUpdatedMark,
|
||||
scrollHeight: itemTop,
|
||||
start: startIndex,
|
||||
end: endIndex,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Ref, ref, VNodeProps } from 'vue';
|
||||
import { reactive, VNodeProps } from 'vue';
|
||||
import { GetKey } from '../interface';
|
||||
|
||||
type CacheMap = Record<string, number>;
|
||||
@ -7,10 +7,9 @@ export default function useHeights<T>(
|
||||
getKey: GetKey<T>,
|
||||
onItemAdd?: ((item: T) => void) | null,
|
||||
onItemRemove?: ((item: T) => void) | null,
|
||||
): [(item: T, instance: HTMLElement) => void, () => void, CacheMap, Ref<number>] {
|
||||
): [(item: T, instance: HTMLElement) => void, () => void, CacheMap] {
|
||||
const instance = new Map<VNodeProps['key'], HTMLElement>();
|
||||
const heights = {};
|
||||
const updatedMark = ref(0);
|
||||
const heights = reactive({});
|
||||
let heightUpdateId = 0;
|
||||
function collectHeight() {
|
||||
heightUpdateId += 1;
|
||||
@ -28,7 +27,6 @@ export default function useHeights<T>(
|
||||
}
|
||||
}
|
||||
});
|
||||
updatedMark.value++;
|
||||
});
|
||||
}
|
||||
|
||||
@ -53,5 +51,5 @@ export default function useHeights<T>(
|
||||
}
|
||||
}
|
||||
|
||||
return [setInstance, collectHeight, heights, updatedMark];
|
||||
return [setInstance, collectHeight, heights];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user