mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-11-18 05:44:12 +08:00
20 lines
304 B
JavaScript
20 lines
304 B
JavaScript
|
/**
|
||
|
* A hook used to scroll to the bottom of an element
|
||
|
* whenever it receives LV update.
|
||
|
*/
|
||
|
const ScrollOnUpdate = {
|
||
|
mounted() {
|
||
|
this.__scroll();
|
||
|
},
|
||
|
|
||
|
updated() {
|
||
|
this.__scroll();
|
||
|
},
|
||
|
|
||
|
__scroll() {
|
||
|
this.el.scrollTop = this.el.scrollHeight;
|
||
|
},
|
||
|
};
|
||
|
|
||
|
export default ScrollOnUpdate;
|