vue触底加载

触底加载

mounted(){
	window.addEventListener('scroll', this.getbottom)
},
methods: {
	...mapMutations(['jcom_dyn_details', 'clearjcom']),
    getbottom(){
		let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
		let clientHeight = document.documentElement.clientHeight || 						document.body.clientHeight;
		let scrollHeight = document.documentElement.scrollHeight || 						document.body.scrollHeight;
		let numHeight = scrollTop + clientHeight;
		if(scrollHeight > clientHeight && numHeight > scrollHeight - 1){
			console.log(1)
		}
// $(window).scroll(()=>{
//   var scrollTop = $(window).scrollTop();
//   var scrollHeight = $(document).height();
//   var windowHeight = $(window).height();
//   if (scrollTop + windowHeight == scrollHeight) {
//     console.log(1)
//   }
// });
},
}

你可能感兴趣的:(vue触底加载)