panhui пре 2 година
родитељ
комит
7390a63699
2 измењених фајлова са 8 додато и 3 уклоњено
  1. 1 1
      .env.development
  2. 7 2
      src/views/chat/Detail.vue

+ 1 - 1
.env.development

@@ -1,4 +1,4 @@
-VUE_APP_BASE_URL=https://www.raex.vip/
+VUE_APP_BASE_URL=https://test.raex.vip/
 NODE_ENV=development
 VUE_APP_PUBLIC_PATH=/
 ASSETS_PATH=raex

+ 7 - 2
src/views/chat/Detail.vue

@@ -30,6 +30,7 @@
             }"
             @click="toggleEmoji(false)"
             ref="listRef"
+            id="vanList"
         >
             <van-pull-refresh v-model="isLoading" @refresh="onRefresh" :disabled="finishedPage">
                 <!-- <div class="tips" v-if="finishedPage">没有更多了</div> -->
@@ -259,7 +260,7 @@ const title = computed(() => {
 });
 
 function goBottom() {
-    listRef.value.scrollTop = listRef.value.scrollHeight;
+    document.getElementById('vanList').scrollTop = document.getElementById('vanList').scrollHeight;
 }
 
 function submit(e) {
@@ -364,7 +365,11 @@ onMounted(() => {
                 console.log(msg);
                 if (msg.to === teamId.value) {
                     list.value = getPushMsg(msg, list.value);
-                    if (listRef.value.scrollTop + 100 > listRef.value.scrollHeight) {
+                    if (
+                        document.getElementById('vanList').scrollTop + document.getElementById('vanList').clientHeight >
+                            document.getElementById('vanList').scrollHeight - 100 ||
+                        msg.from === store.state.userInfo.id
+                    ) {
                         nextTick(() => {
                             goBottom();
                         });