浏览代码

feat: 调整下拉加载后滚动高度

jack 5 月之前
父节点
当前提交
80b506a2c6

+ 0 - 1
src/components/MoreFilters/src/MoreFilters.vue

@@ -1018,7 +1018,6 @@ import { useThemeStore } from '@/stores/modules/theme'
 const themeStore = useThemeStore()
 
 const moreFiltersGuideImg = computed(() => {
-  console.log('props.pageMode', props.pageMode)
   if (props.pageMode === 'tracking') {
     return themeStore.theme === 'dark' ? trackingMoreFiltersImgDark : trackingMoreFiltersImgLight
   } else {

+ 1 - 1
src/components/NotificationMessageCard/src/NotificationMessageCard.vue

@@ -215,7 +215,7 @@ const onScroll = () => {
   const el = scrollContainerRef.value
   if (!el || loading.value || finished.value) return
 
-  prevScrollTop.value = el.scrollTop
+  prevScrollTop.value = el.scrollTop + 50
 
   const threshold = 50 // 提前50px触发
   if (el.scrollHeight - el.scrollTop - el.clientHeight <= threshold) {

+ 0 - 26
src/views/Layout/src/components/Header/components/NotificationDrawer.vue

@@ -18,32 +18,6 @@ const notificationTypeList = ref({
   Feature_Update: 'Feature Update'
 })
 
-// const notificationContentRef = ref<HTMLElement | null>(null)
-// const finished = ref(false)
-// const prevScrollTop = ref(0)
-// const scrollContainerRef = ref()
-// const onScroll = () => {
-//   const el = scrollContainerRef.value
-//   if (!el || loading.value || finished.value) return
-
-//   prevScrollTop.value = el.scrollTop
-
-//   const threshold = 50 // 提前50px触发
-//   if (
-//     el.scrollHeight - el.scrollTop - el.clientHeight <= threshold &&
-//     (loading.value || finished.value)
-//   ) {
-//     loading.value = true
-//     getNotificationList()
-//   }
-// }
-// onMounted(() => {
-//   scrollContainerRef.value = notificationContentRef.value?.querySelector('.scroller') as HTMLElement
-//   const el = scrollContainerRef.value
-//   if (!el) return
-//   el.addEventListener('scroll', onScroll)
-// })
-
 const notificationList = ref<any[]>([])
 const notificationMessageCardRef = ref()
 const pageInfo = ref({

+ 2 - 10
src/views/SystemMessage/src/components/SystemMessageDetail.vue

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