I click an item from the list to enter the details, and I will re-request the data when I return to the page, so I use keep-alive to cache the page and find that the scroll to the address I wrote on the list page will load more to the details page.
index.js
{
path: "/",
name: "index",
component: index,
meta: { keepAlive: true }
},
{
path: "/newinfo",
name: "newinfo",
component: newinfo
},
index.vue
loadmore(){
let that=this
if (($(window).scrollTop() + $(window).height()) >=$(document).height()-100 &&that.isbool==true) {
that.isbool=false;
setTimeout(() => {
that.more()
that.isbool=true;
}, 1000);
}
},
index.vue
activated(){
if (screen.width<768) {
window.addEventListener("scroll",this.loadmore)
}
}
index.vue
deactivated(){
window.removeEventListener("scroll",this.loadmore)
},