提交 2c7b2f8c 编写于 作者: G guoweijia

fix:优化@用户

上级 f97bff3a
import { getPosition, formatText } from "@/assets/js/utils"; import { getPosition, formatText } from "@/assets/js/utils";
export default { export default {
data() {
return {
allUserList: []
};
},
methods: { methods: {
handleSelectUser(user) { handleSelectUser(user) {
const originalText = this.textContent; const originalText = this.textContent;
...@@ -27,7 +32,7 @@ export default { ...@@ -27,7 +32,7 @@ export default {
const startPosition = this.queryInfo.startPosition; const startPosition = this.queryInfo.startPosition;
const keyWord = this.textContent.slice(startPosition, endPosition); const keyWord = this.textContent.slice(startPosition, endPosition);
this.queryInfo.endPosition = endPosition; this.queryInfo.endPosition = endPosition;
console.log(e, e.data);
if (endPosition < startPosition || (e.returnValue && e.data === " ")) { if (endPosition < startPosition || (e.returnValue && e.data === " ")) {
// if (endPosition < startPosition || keyWord.slice(-1) === " ") { // if (endPosition < startPosition || keyWord.slice(-1) === " ") {
this.showSelectUser = false; this.showSelectUser = false;
...@@ -41,8 +46,7 @@ export default { ...@@ -41,8 +46,7 @@ export default {
// // console.log('aaa'); // // console.log('aaa');
// // console.log(e); // // console.log(e);
// // alert(e.key) // // alert(e.key)
// if (e.key === "@" || (e.key === "Process" && e.code === "Digit2")) { // if (e.key === "@" || (e.key === "Process" && e.code === "Digit2")) {
// this.createSelectUserDialog(); // this.createSelectUserDialog();
// } // }
...@@ -95,6 +99,9 @@ export default { ...@@ -95,6 +99,9 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
const userList = this.userList; const userList = this.userList;
if (userList === false) return; if (userList === false) return;
if (this.queryInfo.keyWord === "") {
this.allUserList = userList;
}
this.showSelectUser = true; this.showSelectUser = true;
this.$nextTick(() => { this.$nextTick(() => {
const list = textEl.parentNode.querySelector(".md_select_user"); const list = textEl.parentNode.querySelector(".md_select_user");
...@@ -107,9 +114,9 @@ export default { ...@@ -107,9 +114,9 @@ export default {
}); });
}, },
getUserByName(name) { getUserByName(name) {
const userList = this.userList; const userList = this.allUserList;
if (!userList.length) return ""; if (!userList.length) return "";
return userList.find(item => item.nickname === name); return userList.find((item) => item.nickname === name);
} }
} }
}; };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册