Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Commit

Permalink
解決手動@ 沒有從光標処添加問題
Browse files Browse the repository at this point in the history
  • Loading branch information
imlinhanchao committed Nov 12, 2021
1 parent c37d22b commit 93f5bc9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/renderer/view/chat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@
},
appendMsg(regexp, data){
let preMsg = this.message.slice(0, this.lastCursor)
.replace(regexp, data);
if(regexp) preMsg = preMsg.replace(regexp, data);
else preMsg += data;
this.message = preMsg + this.message.slice(this.lastCursor);
this.$nextTick(() => {
this.$refs['message'].focus();
Expand All @@ -282,8 +283,8 @@
});
},
atMsg(item) {
this.message += `@${item.userName} `;
this.$refs['message'].focus();
this.lastCursor = this.msgCursor();
this.appendMsg(null, `@${item.userName} `)
},
atUser(i) {
let data = '@' + this.atList[i].userName + ' ';
Expand Down

0 comments on commit 93f5bc9

Please sign in to comment.