Created
November 26, 2021 02:35
-
-
Save ayoub-bousetta/b93217e47c765b3a0c2b8e36686e36f7 to your computer and use it in GitHub Desktop.
Revisions
-
ayoub-bousetta created this gist
Nov 26, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ 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} }