|
|
@@ -26,21 +26,14 @@ const pageInfo = ref({
|
|
|
const scrollContainerRef = ref<HTMLElement | null>(null)
|
|
|
const isScrollLoading = ref(false)
|
|
|
const prevScrollTop = ref(0)
|
|
|
-const adjustScrollTop = () => {
|
|
|
- const el = scrollContainerRef.value
|
|
|
- if (el) {
|
|
|
- // 如果滚动容器存在,调整其 scrollTop
|
|
|
- el.scrollTop = prevScrollTop.value
|
|
|
- }
|
|
|
-}
|
|
|
+
|
|
|
const onScroll = async () => {
|
|
|
const el = scrollContainerRef.value
|
|
|
if (!el || isScrollLoading.value || finished.value) return
|
|
|
|
|
|
- prevScrollTop.value = el.scrollTop
|
|
|
+ prevScrollTop.value = el.scrollTop + 50
|
|
|
|
|
|
const threshold = 50 // 提前50px触发
|
|
|
- console.log('onScroll', el.scrollHeight, el.scrollTop, el.clientHeight, threshold)
|
|
|
if (el.scrollHeight - el.scrollTop - el.clientHeight <= threshold) {
|
|
|
loading.value = true
|
|
|
isScrollLoading.value = true
|
|
|
@@ -78,7 +71,6 @@ const getNotificationList = async () => {
|
|
|
}
|
|
|
})
|
|
|
.finally(() => {
|
|
|
- console.log('getNotificationList finished')
|
|
|
loading.value = false
|
|
|
isScrollLoading.value = false
|
|
|
})
|