滚动动画bug修复,及丝滑一点

This commit is contained in:
sijinhui 2024-09-30 14:31:15 +08:00
parent 909834d4b4
commit bf457c6853

View File

@ -438,14 +438,23 @@ function useScrollToBottom(
if (dom) { if (dom) {
requestAnimationFrame(() => { requestAnimationFrame(() => {
setAutoScroll(true); setAutoScroll(true);
dom.scrollTo(0, dom.scrollHeight); // dom.scrollTo(0, dom.scrollHeight);
// 丝滑一点
dom.scrollTo({
top: dom.scrollHeight,
behavior: "smooth",
});
}); });
} }
} }
// auto scroll // auto scroll
useEffect(() => { useEffect(() => {
if (autoScroll && !detach) { // if (autoScroll && !detach) {
// scrollDomToBottom();
// }
// 自动滚动一直有bug直接强制修改了
if (autoScroll) {
scrollDomToBottom(); scrollDomToBottom();
} }
}); });