定义监听滚动条的方法
// 生命周期函数
mounted () {
window.addEventListener('scroll', this.handleScroll, true)
},
// 保存滚动值,这是兼容的写法
handleScroll () {
let x_scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
if(x_scrollTop > 150) {
this.x_isFixed = true
}else {
this.x_isFixed = false
}
},