@@ -3,37 +3,32 @@ import { ref, nextTick } from "vue";
33import Top from " ./components/Top.vue" ;
44import Bottom from " ./components/Bottom.vue" ;
55import Checkbox from " ./components/Checkbox.vue" ;
6-
76let page = 0 ;
87let mount = ref (true );
98let resetData = ref (false );
109let target = ref (" .bottom-results" );
11- let distance = ref (100 );
10+ let distance = ref (0 );
1211let top = ref (false );
1312let comments = ref ([]);
1413let mountname = ref (" Unmount" );
15-
1614const refresh = () => {
1715 page = 0 ;
1816 comments .value .length = 0 ;
1917 resetData .value = ! resetData .value ;
2018};
21-
2219const reset = () => {
2320 target .value = " .bottom-results" ;
24- distance .value = 100 ;
21+ distance .value = 0 ;
2522 top .value = false ;
2623 mount .value = true ;
2724 mountname .value = " Unmount" ;
2825 refresh ();
2926};
30-
3127const mountToggler = async () => {
3228 mount .value = ! mount .value ;
3329 if (! mount .value ) mountname .value = " Mount" ;
3430 else mountname .value = " Unmount" ;
3531};
36-
3732const targetToggler = async () => {
3833 top .value = false ;
3934 if (target .value ) target .value = false ;
@@ -44,18 +39,21 @@ const targetToggler = async () => {
4439 mountToggler ();
4540 refresh ();
4641};
47-
4842const topToggler = async () => {
4943 top .value = ! top .value ;
5044 if (top .value ) target .value = " .top-results" ;
5145 else target .value = " .bottom-results" ;
46+ mountToggler ();
47+ await nextTick ();
48+ mountToggler ();
5249 refresh ();
5350};
54-
5551const distanceHandler = async () => {
52+ mountToggler ();
53+ await nextTick ();
54+ mountToggler ();
5655 refresh ();
5756};
58-
5957const load = async $state => {
6058 console .log (" loading more..." );
6159 page++ ;
@@ -78,12 +76,19 @@ const load = async $state => {
7876
7977<template >
8078 <div class =" settings" >
81- <a target =" _blank" href =" https://github.com/oumoussa98/vue3-infinite-loading/tree/main/example" >
79+ <a
80+ target =" _blank"
81+ href =" https://github.com/oumoussa98/vue3-infinite-loading/tree/main/example"
82+ >
8283 <img src =" ./assets/github.svg" alt =" github icon" />
8384 </a >
8485 <span class =" props" >
85- <Checkbox :checked =" top" :disabled =" !target" label =" top" @click =" topToggler" > Top </Checkbox >
86- <Checkbox :checked =" target" label =" target" @click =" targetToggler" > Target </Checkbox >
86+ <Checkbox :checked =" top" :disabled =" !target" label =" top" @click =" topToggler" >
87+ Top
88+ </Checkbox >
89+ <Checkbox :checked =" target" label =" target" @click =" targetToggler" >
90+ Target
91+ </Checkbox >
8792 <div >
8893 Distance:
8994 <input
@@ -226,6 +231,9 @@ body {
226231 background : #101011 ;
227232 border-radius : 10px ;
228233}
234+ .loader {
235+ padding : 10px ;
236+ }
229237.results ::-webkit-scrollbar-track {
230238 border-radius : 4px ;
231239 background : #333536 ;
0 commit comments