Skip to content

Commit 5e0490d

Browse files
committed
(fix) smooth scroll when receiving a message
1 parent 9a2bf28 commit 5e0490d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ChatWindow/Room/Room.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,9 @@ export default {
845845
scrollToBottom() {
846846
setTimeout(() => {
847847
const element = this.$refs.scrollContainer
848+
element.classList.add('vac-scroll-smooth')
848849
element.scrollTo({ top: element.scrollHeight, behavior: 'smooth' })
850+
setTimeout(() => element.classList.remove('vac-scroll-smooth'), 0)
849851
}, 50)
850852
},
851853
onChangeInput() {
@@ -1007,6 +1009,10 @@ export default {
10071009
margin-right: 1px;
10081010
margin-top: 60px;
10091011
-webkit-overflow-scrolling: touch;
1012+
1013+
&.vac-scroll-smooth {
1014+
scroll-behavior: smooth;
1015+
}
10101016
}
10111017
10121018
.vac-messages-container {

0 commit comments

Comments
 (0)