diff --git a/pkg_common/views/message.vue b/pkg_common/views/message.vue index cb6a732..f756d20 100644 --- a/pkg_common/views/message.vue +++ b/pkg_common/views/message.vue @@ -183,14 +183,16 @@ export default { showSendBtn(item) { // 显示发送按钮 this.showBtn = true - // 延迟100ms,否则无法聚焦 - setTimeout(() => { - // 自动聚焦 - this.autoFocus = true - this.currentComment = item - this.content = '@' + item.senderUserNickname + ' ' - this.cursorIndex = this.content.length - }, 100) + this.currentComment = item + this.content = '@' + item.senderUserNickname + ' ' + this.$nextTick(() => { + // 延迟100ms,否则无法聚焦 + setTimeout(() => { + // 自动聚焦 + this.autoFocus = true + this.cursorIndex = this.content.length + }, 100) + }) }, /** * 失焦