diff --git a/webpack/vue/auth/channel.vue b/webpack/vue/auth/channel.vue index a053c95..9f522b4 100644 --- a/webpack/vue/auth/channel.vue +++ b/webpack/vue/auth/channel.vue @@ -8,7 +8,7 @@
-
+
@@ -39,7 +39,8 @@ export default { message: '', // message text pressed: { 16: false // SHIFT key - } + }, + stack_length: 0 }; }, @@ -99,6 +100,27 @@ export default { } + }, + + updated(){ + + let stack_length = this.$refs.stack.children.length; + + + /* (1) If new messages -> scroll to bottom */ + if( stack_length > this.stack_length ){ + + this.$refs.stack.scrollTop = 10000; + + // manage overriding css animation + setTimeout( () => { this.$refs.stack.scrollTop = 10000 }, 300 ); + + } + + /* (2) If new messages -> update stack length */ + if( stack_length != this.stack_length ) + this.stack_length = stack_length; + } }