|
@@ -10,10 +10,14 @@ import { onBeforeUnmount, onMounted, ref } from "vue"
|
10
|
10
|
const style = ref({ opacity: 1 })
|
11
|
11
|
|
12
|
12
|
const onScroll = (e) => {
|
13
|
|
- const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
14
|
|
- const offsetHeight = document.documentElement.offsetHeight || document.body.offsetHeight;
|
15
|
|
- const scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
|
16
|
|
- if (offsetHeight + scrollTop >= scrollHeight) {
|
|
13
|
+ // const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
|
14
|
+ // const offsetHeight = document.documentElement.offsetHeight || document.body.offsetHeight;
|
|
15
|
+ // const scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
|
|
16
|
+ // const isBottom = offsetHeight + scrollTop >= scrollHeight;
|
|
17
|
+
|
|
18
|
+ const isBottom = (window.innerHeight + window.scrollY) >= (document.body.scrollHeight - 100);
|
|
19
|
+
|
|
20
|
+ if (isBottom) {
|
17
|
21
|
style.value = { opacity: 0 }
|
18
|
22
|
console.log('已到底部');
|
19
|
23
|
} else {
|