From c443675e059d64740e2d804218f8bc5090d2f70c Mon Sep 17 00:00:00 2001 From: "xie.bx" Date: Tue, 15 Nov 2022 12:38:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BE=A4=E6=88=90=E5=91=98?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- im-ui/src/components/chat/ChatBox.vue | 8 +++++--- im-ui/src/store/chatStore.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/im-ui/src/components/chat/ChatBox.vue b/im-ui/src/components/chat/ChatBox.vue index 3ba8913..c5c4fdb 100644 --- a/im-ui/src/components/chat/ChatBox.vue +++ b/im-ui/src/components/chat/ChatBox.vue @@ -382,7 +382,7 @@ watch: { chat: { handler(newChat, oldChat) { - if (newChat.targetId > 0 && (newChat.type != oldChat.type || newChat.targetId != oldChat.targetId)) { + if (newChat.targetId > 0 && (!oldChat || newChat.type != oldChat.type || newChat.targetId != oldChat.targetId)) { if (this.chat.type == "GROUP") { this.loadGroup(this.chat.targetId); } else { @@ -391,10 +391,12 @@ this.scrollToBottom(); this.sendText = ""; // 保持输入框焦点 - this.$refs.sendBox.focus(); + this.$nextTick(() => { + this.$refs.sendBox.focus(); + }) } }, - deep: true + immediate: true } } } diff --git a/im-ui/src/store/chatStore.js b/im-ui/src/store/chatStore.js index ca1debf..2a26d71 100644 --- a/im-ui/src/store/chatStore.js +++ b/im-ui/src/store/chatStore.js @@ -7,7 +7,7 @@ export default { mutations: { initChatStore(state) { - state.activeIndex = -1; + //state.activeIndex = -1; }, openChat(state, chatInfo) { let chat = null;