<div id="aside" class="bs-aside" :class="{'is_fixed' : isFixed}">
<asidePreview></asidePreview>
</div>
mounted() {
window.addEventListener('scroll', this.handleScroll);
this.$nextTick(() => {
this.offsetTop = document.querySelector('#aside').offsetTop;
})
},
destroyed() {
window.removeEventListener('scroll', this.handleScroll)
},
methods: {
handleScroll() {
var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
this.isFixed = scrollTop > this.offsetTop ? true : false;
console.log(scrollTop)
if(scrollTop > 1400){
this.isFixed = false
}
},
},