@@ -3,35 +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" );
10+ let distance = ref (0 );
1111let top = ref (false );
1212let comments = ref ([]);
1313let mountname = ref (" Unmount" );
14-
1514const refresh = () => {
1615 page = 0 ;
1716 comments .value .length = 0 ;
1817 resetData .value = ! resetData .value ;
1918};
20-
2119const reset = () => {
2220 target .value = " .bottom-results" ;
21+ distance .value = 0 ;
2322 top .value = false ;
2423 mount .value = true ;
2524 mountname .value = " Unmount" ;
2625 refresh ();
2726};
28-
2927const mountToggler = async () => {
3028 mount .value = ! mount .value ;
3129 if (! mount .value ) mountname .value = " Mount" ;
3230 else mountname .value = " Unmount" ;
3331};
34-
3532const targetToggler = async () => {
3633 top .value = false ;
3734 if (target .value ) target .value = false ;
@@ -42,17 +39,21 @@ const targetToggler = async () => {
4239 mountToggler ();
4340 refresh ();
4441};
45-
4642const topToggler = async () => {
4743 top .value = ! top .value ;
4844 if (top .value ) target .value = " .top-results" ;
4945 else target .value = " .bottom-results" ;
46+ mountToggler ();
47+ await nextTick ();
48+ mountToggler ();
5049 refresh ();
50+ };
51+ const distanceHandler = async () => {
5152 mountToggler ();
5253 await nextTick ();
5354 mountToggler ();
55+ refresh ();
5456};
55-
5657const load = async $state => {
5758 console .log (" loading more..." );
5859 page++ ;
@@ -88,6 +89,15 @@ const load = async $state => {
8889 <Checkbox :checked =" target" label =" target" @click =" targetToggler" >
8990 Target
9091 </Checkbox >
92+ <div >
93+ Distance:
94+ <input
95+ @change =" distanceHandler"
96+ class =" distance"
97+ v-model.number.lazy =" distance"
98+ type =" text"
99+ />
100+ </div >
91101 </span >
92102 <span class =" buttons" >
93103 <button class =" btn-mount" @click =" mountToggler" >{{ mountname }}</button >
@@ -98,16 +108,18 @@ const load = async $state => {
98108 <div v-if =" mount" >
99109 <Top
100110 v-if =" top"
101- :target = " target "
111+ :distance = " distance "
102112 :comments =" comments"
103113 :identifier =" resetData"
114+ :target =" target"
104115 @infinite =" load"
105116 />
106117 <Bottom
107118 v-if =" !top"
108- :target = " target "
119+ :distance = " distance "
109120 :comments =" comments"
110121 :identifier =" resetData"
122+ :target =" target"
111123 @infinite =" load"
112124 />
113125 </div >
@@ -161,6 +173,15 @@ body {
161173 gap : 20px ;
162174 flex-wrap : wrap ;
163175}
176+ .distance {
177+ width : 50px ;
178+ border-radius : 5px ;
179+ padding : 4px 5px ;
180+ outline : none ;
181+ border : none ;
182+ background : #6a6c6d ;
183+ color : inherit ;
184+ }
164185.buttons {
165186 display : flex ;
166187 gap : 20px ;
@@ -210,6 +231,9 @@ body {
210231 background : #101011 ;
211232 border-radius : 10px ;
212233}
234+ .loader {
235+ padding : 10px ;
236+ }
213237.results ::-webkit-scrollbar-track {
214238 border-radius : 4px ;
215239 background : #333536 ;
0 commit comments