Jelajahi Sumber

聊天室保证刷新后,滚动条在底部

jubs 2 bulan lalu
induk
melakukan
264d74b42c
1 mengubah file dengan 14 tambahan dan 4 penghapusan
  1. 14 4
      ruoyi-ui-vue2/src/components/FloatingComponent/index.vue

+ 14 - 4
ruoyi-ui-vue2/src/components/FloatingComponent/index.vue

@@ -494,10 +494,20 @@ export default {
           if (scroll) {
             scroll.addEventListener('scroll', that.scrollHandle, true);
             //如果是第一次进入,则滚动至底部
-            scroll.scrollTo({
-              top: this.activeScrollTop,
-              behavior: 'smooth'
-            })
+            if(this.firstEnter){
+              scroll.scrollTo({
+                top: scroll.scrollHeight,
+                behavior: 'smooth'
+              })
+            }else {
+
+              scroll.scrollTo({
+                top: this.activeScrollTop,
+                behavior: 'smooth'
+              })
+
+
+            }
           }
         }, 200)