Skip to content

Commit

Permalink
fix: 修复首次未满屏时可能触发多次加载的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
gk-shi committed May 13, 2024
1 parent e1286b0 commit 39f60c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/v3-waterfall.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ const { anchorObserver, anchorDisconnect, anchorIsHidden } = useAnchorObserver()
// 校验加载一次数据后底部锚点元素是否隐藏,没隐藏还需要再加载一次数据
watch(actualLoading, (newV) => {
if (!newV) {
if (!newV && !isOver.value) {
setTimeout(() => {
const viewport = scrollElement || document.documentElement || document.body
const anchor = document.getElementById(anchorID)
Expand Down Expand Up @@ -223,6 +223,7 @@ watch(isOver, (newV, oldV) => {
})
const waterfall = async (noLayoutedList: WaterfallList<T>) => {
if (!noLayoutedList || !noLayoutedList.length) return
isInnerLoading.value = true
try {
await layout(noLayoutedList)
Expand Down Expand Up @@ -296,6 +297,7 @@ const reRender = init
// 在队列之前插入,支持类似下拉刷新的场景
const insertBefore = async (insertList: WaterfallList<T>) => {
if (!insertList || !insertList.length) return
isInnerLoading.value = true
try {
const listRef = ref(insertList) as Ref<WaterfallList<T>>
Expand Down

0 comments on commit 39f60c8

Please sign in to comment.