This commit is contained in:
syuilo
2018-06-05 22:54:03 +09:00
parent e28d1c7569
commit dfa2c951d6
7 changed files with 72 additions and 23 deletions

View File

@ -73,16 +73,20 @@ export default Vue.extend({
}
},
inject: ['getColumn', 'getScrollContainer'],
created() {
this.getColumn().$once('mounted', () => {
this.rootEl = this.getScrollContainer();
this.rootEl.addEventListener('scroll', this.onScroll);
})
},
beforeDestroy() {
this.root.removeEventListener('scroll', this.onScroll);
this.rootEl.removeEventListener('scroll', this.onScroll);
},
methods: {
mount(root) {
this.rootEl = root;
this.rootEl.addEventListener('scroll', this.onScroll);
},
isScrollTop() {
if (this.rootEl == null) return true;
return this.rootEl.scrollTop <= 8;