Skip to content

Commit

Permalink
Scroll messages to bottom when showing them
Browse files Browse the repository at this point in the history
  • Loading branch information
Zomis committed Mar 23, 2019
1 parent 3fc6e45 commit d0cfdbe
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/views/lobby/Messages.vue
Expand Up @@ -34,15 +34,21 @@ export default {
data() {
return { message: "" };
},
mounted() {
this.scrollToBottom();
},
watch: {
messages() {
this.scrollToBottom();
}
},
methods: {
scrollToBottom() {
this.$nextTick(() => {
let container = this.$refs.container;
container.scrollTop = container.scrollHeight;
});
}
},
methods: {
},
sendMessage() {
if (this.message.trim().length === 0) {
return;
Expand Down

0 comments on commit d0cfdbe

Please sign in to comment.