Created
November 26, 2021 02:35
-
-
Save ayoub-bousetta/b93217e47c765b3a0c2b8e36686e36f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setup(props) { | |
let products= ref(props.Product) | |
window.addEventListener('scroll',debounce((e)=>{ | |
let pixelfrombottom = document.documentElement.offsetHeight - document.documentElement.scrollTop - window.innerHeight | |
if(pixelfrombottom < 200){ | |
axios.get(products.value.next_page_url).then(res=>{ | |
products.value={ | |
...res.data, | |
data:[...products.value.data,...res.data.data] | |
} | |
}) | |
} | |
},100)) | |
return {products} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment