diff --git a/src/layout/components/Header/RecycleModal.vue b/src/layout/components/Header/RecycleModal.vue index c9f9b7c..4ae54e0 100644 --- a/src/layout/components/Header/RecycleModal.vue +++ b/src/layout/components/Header/RecycleModal.vue @@ -29,6 +29,7 @@ const similarRange = ref('desc') const batch = ref(false) const imageRef = ref(); let filterId = null; +const isTop = ref(false) let sortObj: any = { orderByUptime: 'desc' }; @@ -110,7 +111,11 @@ const layout = debounce(() => { const scrollHeight = el.value!.scrollHeight const clientHeight = el.value!.clientHeight const top = scrollHeight - clientHeight - 20 - el.value!.scrollTo({ top, behavior: 'instant' }) + if(isTop.value) { + el.value!.scrollTo({ top: 0, behavior: 'instant' }) + }else { + el.value!.scrollTo({ top, behavior: 'instant' }) + } // let height = 800 - 15; // const screenWidth = window.screen.width; // if(screenWidth <= 1920) { @@ -119,10 +124,22 @@ const layout = debounce(() => { // el.value!.scrollTo({ top: height, behavior: 'instant' }) loading = false console.log("loading---------------", loading); + console.log("pagination.pageNo---------------", pagination.pageNo); + if(pagination.pageNo == 3) { + let timer; + if(timer) { + clearTimeout(timer); + } + timer = setTimeout(() => { + isTop.value = false + console.log("isTop.value---------------", isTop.value); + }, 1000) + } }) }, 300) watch(viewMode, () => { + isTop.value = true; layout() }) @@ -402,6 +419,7 @@ async function onChange() { canloadMore = true; const list = await featchList() listData.value = list + isTop.value = true; layout() } @@ -419,6 +437,7 @@ async function onChangeView() { canloadMore = true; const list = await featchList() listData.value = list + isTop.value = true; layout() }