Evaluate live chat scroll check on scrollend (#5302)

This commit is contained in:
Jason 2024-06-22 21:18:37 +00:00 committed by GitHub
parent 5c390dada5
commit 4592b18db9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 5 deletions

View File

@ -306,7 +306,7 @@ export default defineComponent({
}
},
onScroll: function (event) {
onScroll: function (event, isScrollEnd = false) {
const liveChatComments = this.$refs.liveChatComments
if (event.wheelDelta >= 0 && this.stayAtBottom) {
this.stayAtBottom = false
@ -314,10 +314,8 @@ export default defineComponent({
if (liveChatComments.scrollHeight > liveChatComments.clientHeight) {
this.showScrollToBottom = true
}
} else if (event.wheelDelta < 0 && !this.stayAtBottom) {
if ((liveChatComments.scrollHeight - liveChatComments.scrollTop) === liveChatComments.clientHeight) {
this.scrollToBottom()
}
} else if ((isScrollEnd || event.wheelDelta < 0) && !this.stayAtBottom && (liveChatComments.scrollHeight - liveChatComments.scrollTop) === liveChatComments.clientHeight) {
this.scrollToBottom()
}
},

View File

@ -128,6 +128,7 @@
class="liveChatComments"
:style="{ blockSize: chatHeight }"
@mousewheel="e => onScroll(e)"
@scrollend="e => onScroll(e, true)"
>
<div
v-for="(comment, index) in comments"