Merge branch 'main' into DevelopMadara

This commit is contained in:
Madara0330E
2024-01-30 19:42:07 +03:00
7 changed files with 153 additions and 48 deletions

View File

@@ -91,19 +91,21 @@ export default {
},
created() {
GetChatHistory().then((response) => {
response.forEach((element) => {
let imageUrl = "https://avatar.spworlds.ru/face/55/" + element.userName;
if (response && response.length) {
response.forEach((element) => {
let imageUrl = "https://avatar.spworlds.ru/face/55/" + element.userName;
const MsgUser = {
id: this.id + 1,
msg: element.message,
username: element.userName,
icon: imageUrl,
};
const MsgUser = {
id: this.id + 1,
msg: element.message,
username: element.userName,
icon: imageUrl,
};
this.array.push(MsgUser);
});
this.ScrollToBottom();
this.array.push(MsgUser);
});
this.ScrollToBottom();
}
});
},
};

View File

@@ -42,18 +42,21 @@ export default {
}
},
SendmsgData() {
const formattedWord = this.InsertSpaceEvery24Chars(this.msg);
this.$emit("send", [formattedWord, this.username, this.icon]);
// const formattedWord = this.InsertSpaceEvery24Chars(this.msg);
this.$emit("send", [this.msg, this.username, this.icon]);
this.msg = "";
},
InsertSpaceEvery24Chars(word) {
let result = "";
for (let i = 0; i < word.length; i += 22) {
result += word.substring(i, i + 22) + " ";
}
return result.trim();
},
// InsertSpaceEvery24Chars(text) {
// let result = "";
// for (let i = 0; i < text.length; i++) {
// if (i > 0 && i % 24 === 0) {
// result += " ";
// }
// result += text[i];
// }
// return result;
// },
},
};
</script>