mounted(){
window.addEventListener('scroll',this.menu);
// setTimeout(()=>{
this.a=document.body.scrollHeight||document.documentElement.scrollHeight
this.c = document.documentElement.clientHeight;
// },200)
},
methods: {
menu() {
//this.a=document.body.scrollHeight||document.documentElement.scrollHeight;
this.b=document.body.scrollTop||document.documentElement.scrollTop;
//通过判断滚动条的top位置与可视网页之和与整个网页的高度是否相等来决定是否加载内容;
if(this.b+this.c>=this.a){
setTimeout(()=>{
this.$router.push('/intelligenceb' );
},100)
}
console.log(this.a,this.b, this.c)
}
},
你这个事件是加载window上的,vue切换页面并不是真的跳转重新加载,当然每个页面都生效
该页面beforeDestroy时清理掉事件即可