Skip to content

Commit

Permalink
chore: fix snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn committed Jun 9, 2023
1 parent d31d24b commit b889294
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/back-top/back-top.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,22 @@ export default defineComponent({
return;
}
let scrollDOM: HTMLElement;
if (containerRef.value.scrollTop === undefined) {
scrollDOM = document.documentElement;
} else {
scrollDOM = containerRef.value;
}
containerRef.value.onscroll = () => {
const { scrollTop } = scrollDOM;
if (scrollTop >= visibleHeight) {
visible.value = true;
if (containerRef.value) {
if (containerRef.value.scrollTop === undefined) {
scrollDOM = document.documentElement;
} else {
scrollDOM = containerRef.value;
}
if (scrollTop < visibleHeight && visible.value) {
visible.value = false;
}
};
containerRef.value.onscroll = () => {
const { scrollTop } = scrollDOM;
if (scrollTop >= visibleHeight) {
visible.value = true;
}
if (scrollTop < visibleHeight && visible.value) {
visible.value = false;
}
};
}
});

onBeforeUnmount(() => {
Expand Down

0 comments on commit b889294

Please sign in to comment.