Skip to content

Commit 5d382f8

Browse files
enoottttlihuifeng
andauthored
fix: Fix the problem that the BubbleList component cannot trigger scrolling (#101)
Co-authored-by: lihuifeng <[email protected]>
1 parent cf2f9bb commit 5d382f8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/bubble/BubbleList.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import useDisplayData from './hooks/useDisplayData';
99
import useListData from './hooks/useListData';
1010
import type { BubbleListProps } from './interface';
1111
import useStyle from './style';
12-
import { computed, type HTMLAttributes, mergeProps, onWatcherCleanup, ref, unref, useAttrs, watch, watchEffect } from 'vue';
12+
import { computed, type HTMLAttributes, mergeProps, onWatcherCleanup, ref, unref, useAttrs, watch, watchEffect, nextTick } from 'vue';
1313
import useState from '../_util/hooks/use-state';
1414
import BubbleContextProvider from './context';
1515
@@ -85,10 +85,12 @@ const onInternalScroll = (e: Event) => {
8585
8686
watch(updateCount, () => {
8787
if (autoScroll && unref(listRef) && unref(scrollReachEnd)) {
88-
unref(listRef).scrollTo({
88+
nextTick(() => {
89+
unref(listRef).scrollTo({
8990
top: unref(listRef).scrollHeight,
9091
});
91-
}
92+
})
93+
}
9294
});
9395
9496
// Always scroll to bottom when data change

0 commit comments

Comments
 (0)