File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -479,20 +479,25 @@ export default {
479
479
const element = this .$refs .scrollContainer
480
480
if (! element) return
481
481
482
+ function scrollToBottom () {
483
+ setTimeout (() => {
484
+ const options = { top: element .scrollHeight , behavior: ' smooth' }
485
+ element .scrollTo (options)
486
+ }, 50 )
487
+ }
488
+
482
489
if (oldVal && newVal && oldVal .length === newVal .length - 1 ) {
483
490
this .loadingMessages = false
484
491
485
- if (
486
- newVal[newVal .length - 1 ].senderId === this .currentUserId ||
487
- this .getBottomScroll (element) < 60
488
- ) {
489
- return setTimeout (() => {
490
- const options = { top: element .scrollHeight , behavior: ' smooth' }
491
- element .scrollTo (options)
492
- }, 50 )
492
+ if (this .getBottomScroll (element) < 60 ) {
493
+ return scrollToBottom ()
493
494
} else {
494
- this .scrollIcon = true
495
- return this .scrollMessagesCount ++
495
+ if (newVal[newVal .length - 1 ].senderId === this .currentUserId ) {
496
+ return scrollToBottom ()
497
+ } else {
498
+ this .scrollIcon = true
499
+ return this .scrollMessagesCount ++
500
+ }
496
501
}
497
502
}
498
503
You can’t perform that action at this time.
0 commit comments