首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >腾讯IM 收消息的时候会触发多次,怎么解决?

腾讯IM 收消息的时候会触发多次,怎么解决?

提问于 2020-05-23 18:46:06
回答 6关注 3查看 2.5K
代码语言:javascript
复制
TIM.EVENT.MESSAGE_RECEIVED
这个事件 收到一条消息会出发很多次
mounted() {
    console.log('IM当前会话', this.currentConversation);
    console.log('IM当前聊天记录', this.messageList, this.$store.state);
    // 收到新消息
    this.tim.on(this.TIM.EVENT.MESSAGE_RECEIVED, this.onReceiveMessage)
    this.isCompleted = this.$store.state.conversation.isCompleted;
  },
  
  
  
  
  
    onReceiveMessage({ data: messageList }) {
      //  没搞清楚为啥可以触发这么多次
      console.log('收到消息', messageList);
      console.log('已有消息', this.currentMessageList);
      this.$store.commit('pushCurrentMessageList', messageList);
      this.scrollMessageListToButtom()
    },

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档