mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
fix: reactivity problem on BaseVirtualScroll component
This commit is contained in:
@ -40,7 +40,6 @@ const bottomHeight: Ref<number> = ref(0);
|
||||
const visibleItems: Ref<any[]> = ref([]);
|
||||
const renderTimeout: Ref<NodeJS.Timeout> = ref(null);
|
||||
const localScrollElement: Ref<HTMLDivElement> = ref(null);
|
||||
const scrollElement = ref(props.scrollElement);
|
||||
|
||||
const checkScrollPosition = () => {
|
||||
clearTimeout(renderTimeout.value);
|
||||
@ -72,12 +71,12 @@ const setScrollElement = () => {
|
||||
if (localScrollElement.value)
|
||||
localScrollElement.value.removeEventListener('scroll', checkScrollPosition);
|
||||
|
||||
localScrollElement.value = scrollElement.value ? scrollElement.value : root.value;
|
||||
localScrollElement.value = props.scrollElement ? props.scrollElement : root.value;
|
||||
updateWindow();
|
||||
localScrollElement.value.addEventListener('scroll', checkScrollPosition);
|
||||
};
|
||||
|
||||
watch(scrollElement, () => {
|
||||
watch(() => props.scrollElement, () => {
|
||||
setScrollElement();
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user