@@ -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;
+
}
}