fix: 偏移量未重置导致列表不加载 懒加载存在data-gap

This commit is contained in:
ZiuChen 2022-08-16 15:53:59 +08:00
parent 0fe391adc0
commit c7e571d6e8

View File

@ -6,7 +6,7 @@
:fullData="fullData"
@onOverlayClick="toggleFullData('')"
></ClipFullData>
<ClipSwitch ref="ClipSwitchRef" @onNavClick="updateShowList">
<ClipSwitch ref="ClipSwitchRef" @onNavClick="handleNavClick">
<template #SidePanel>
<ClipSearch v-model="filterText"></ClipSearch>
</template>
@ -59,6 +59,11 @@ const updateShowList = (type) => {
window.toTop()
}
const handleNavClick = (type) => {
updateShowList(type)
offset.value = 0 //
}
const fullData = ref({ type: 'text', data: '' })
const fullDataShow = ref(false)
const toggleFullData = (item) => {
@ -115,7 +120,7 @@ onMounted(() => {
document.addEventListener('scroll', (e) => {
const { scrollTop, clientHeight, scrollHeight } = e.target.scrollingElement
if (scrollTop + clientHeight + 20 >= scrollHeight) {
offset.value += GAP + 1
offset.value += GAP
let addition = []
if (activeTab.value !== 'all') {
addition = list.value.filter((item) => item.type === activeTab.value)