mirror of
https://github.com/Troplo/Colubrina.git
synced 2024-11-22 19:27:55 +11:00
Update CommunicationsChat.vue
This commit is contained in:
parent
3d7df1c98a
commit
91386b68c0
1 changed files with 26 additions and 24 deletions
|
@ -1115,32 +1115,34 @@ export default {
|
||||||
this.focusInput()
|
this.focusInput()
|
||||||
},
|
},
|
||||||
autoScroll(smooth = false) {
|
autoScroll(smooth = false) {
|
||||||
if (!this.avoidAutoScroll) {
|
this.$nextTick(() => {
|
||||||
try {
|
if (!this.avoidAutoScroll) {
|
||||||
const lastIndex = this.messages.length - 1
|
try {
|
||||||
const lastMessage = document.querySelector(`#message-${lastIndex}`)
|
const lastIndex = this.messages.length - 1
|
||||||
if (smooth) {
|
const lastMessage = document.querySelector(`#message-${lastIndex}`)
|
||||||
lastMessage.scrollIntoView({
|
if (smooth) {
|
||||||
behavior: "smooth",
|
lastMessage.scrollIntoView({
|
||||||
block: "nearest",
|
behavior: "smooth",
|
||||||
inline: "start"
|
block: "nearest",
|
||||||
})
|
inline: "start"
|
||||||
} else {
|
})
|
||||||
lastMessage.scrollIntoView()
|
} else {
|
||||||
}
|
lastMessage.scrollIntoView()
|
||||||
this.autoScrollRetry = 0
|
}
|
||||||
} catch (e) {
|
this.autoScrollRetry = 0
|
||||||
console.log("Could not auto scroll, retrying...")
|
} catch (e) {
|
||||||
if (this.autoScrollRetry < 20) {
|
console.log("Could not auto scroll, retrying...")
|
||||||
setTimeout(() => {
|
if (this.autoScrollRetry < 20) {
|
||||||
this.autoScroll()
|
setTimeout(() => {
|
||||||
}, 50)
|
this.autoScroll()
|
||||||
this.autoScrollRetry++
|
}, 50)
|
||||||
} else {
|
this.autoScrollRetry++
|
||||||
console.log("Could not auto scroll, retry limit reached")
|
} else {
|
||||||
|
console.log("Could not auto scroll, retry limit reached")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
},
|
},
|
||||||
getMessages() {
|
getMessages() {
|
||||||
this.loadingMessages = true
|
this.loadingMessages = true
|
||||||
|
|
Loading…
Reference in a new issue