wujingjing
2025-04-02 7866aa30bd13dab1fc0662e1baf6675d0dc1b282
src/components/chat/hooks/useScroll.ts
@@ -10,11 +10,19 @@
export const useScroll = (option: UseScrollOption) => {
   const { chatListDom } = option;
   const scrollStepToBottom = () => {
      const allStepList = document.querySelectorAll('.step-list');
      const lastStepList = allStepList[allStepList.length - 1];
      if (!lastStepList) return;
      lastStepList.scrollTop = lastStepList.scrollHeight - lastStepList.clientHeight;
   };
   const scrollToBottom = () => {
      nextTick(() => {
         if (chatListDom.value.scrollHeight > chatListDom.value.clientHeight) {
            chatListDom.value.scrollTop = chatListDom.value.scrollHeight - chatListDom.value.clientHeight;
            nextTick(() => {
               scrollStepToBottom();
            });
         }
      });
   };
@@ -24,7 +32,6 @@
         chatListDom.value.scrollTop = 0;
      });
   };
   const checkIsBottom = () => {
      // 误差 2像素