Sfoglia il codice sorgente

优化第一次发言没滚动到底部
优化点击关闭pin消息,阻止事件冒泡

eosgetdice12 5 anni fa
parent
commit
ddb906ac01

+ 9 - 4
_src/components/chatMini/chatMini.vue

@@ -612,7 +612,7 @@ export default {
     /**
      * @des 处理消息发送
      */
-    handleSend (e) {
+    async handleSend (e) {
       // 判断是否被禁言
       if (this.blockList.some(id => id == this.userId)) {
         Message({
@@ -637,6 +637,9 @@ export default {
         msg: text
       }
 
+      // 清空输入框
+      this.inputMsg = ''
+
       // 用户不是第一次发言
       if (this.group.members[this.userId]) {
         let createTime = Date.now()
@@ -650,13 +653,15 @@ export default {
           loading: true
         })
         opt.createTime = createTime
-      }
 
-      this.doSendMsg(opt)
+        this.doSendMsg(opt)
+      } else {
+        // 发言后,才滚动底部
+        await this.doSendMsg(opt)
+      }
 
       // 滚到底部
       this.$nextTick(function () {
-        this.inputMsg = ''
         this.resizeToBottom()
       })
 

+ 4 - 1
_src/components/chatPin/index.vue

@@ -2,7 +2,7 @@
   <div class="chat-pinmsg" v-if="visible" @click="scrollToView">
     <label>消息:</label>
     <div class="msg-content">{{msg | decryptoMsg}}</div>
-    <i class="msg-close" @click="handleClose"></i>
+    <i class="msg-close" @click.stop="handleClose"></i>
   </div>
 </template>
 
@@ -52,6 +52,9 @@ export default {
       } else {
         this.$emit('pinMsgClose')
       }
+
+      //      event.stopPropagation()
+      //      return false
     },
     scrollToView (event) {
       this.$emit('scrollToView')