Test scroll bar logic

This commit is contained in:
Hepatica
2024-01-27 03:30:22 +01:00
parent 7e8063d5ad
commit 5974761ef5

View File

@@ -46,6 +46,12 @@ export default {
}; };
}, },
methods: { methods: {
ScrollToBottom() {
this.$nextTick(() => {
const chatContent = this.$el.querySelector(".chat__content--users");
chatContent.scrollTop = chatContent.scrollHeight;
});
},
ClaimDatamsg(msg) { ClaimDatamsg(msg) {
SendMessageToChat(msg[0]); SendMessageToChat(msg[0]);
@@ -70,6 +76,8 @@ export default {
}; };
this.array.push(MsgUser); this.array.push(MsgUser);
// this.ScrollToBottom();
} catch (error) { } catch (error) {
console.error("Error parsing JSON data:", error); console.error("Error parsing JSON data:", error);
} }
@@ -78,8 +86,7 @@ export default {
created() { created() {
GetChatHistory().then((response) => { GetChatHistory().then((response) => {
response.forEach((element) => { response.forEach((element) => {
let imageUrl = let imageUrl = "https://avatar.spworlds.ru/face/55/" + element.userName;
"https://avatar.spworlds.ru/face/55/" + element.userName;
const MsgUser = { const MsgUser = {
id: this.id + 1, id: this.id + 1,
@@ -90,6 +97,7 @@ export default {
this.array.push(MsgUser); this.array.push(MsgUser);
}); });
this.ScrollToBottom();
}); });
}, },
}; };