1
1
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:
2022-05-11 11:27:29 +02:00
parent d494b17df7
commit 45b2eb2934
3 changed files with 5 additions and 6 deletions

View File

@ -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();
});