|
|
@@ -24,17 +24,21 @@
|
|
24
|
24
|
<h1 class='ion-text-center'>Search not found</h1>
|
|
25
|
25
|
</template>
|
|
26
|
26
|
</ion-list>
|
|
|
27
|
+ <ion-infinite-scroll @ionInfinite="loadMore">
|
|
|
28
|
+ <ion-infinite-scroll-content></ion-infinite-scroll-content>
|
|
|
29
|
+ </ion-infinite-scroll>
|
|
27
|
30
|
</ion-content>
|
|
28
|
31
|
</ion-page>
|
|
29
|
32
|
</template>
|
|
30
|
33
|
|
|
31
|
34
|
<script setup lang="ts">
|
|
32
|
35
|
import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonButton, onIonViewWillEnter, IonList, IonSearchbar, IonLabel,
|
|
33
|
|
-IonItem, IonBackButton, IonProgressBar, IonButtons } from '@ionic/vue';
|
|
|
36
|
+IonItem, IonBackButton, IonProgressBar, IonButtons, IonInfiniteScroll,
|
|
|
37
|
+ IonInfiniteScrollContent, InfiniteScrollCustomEvent } from '@ionic/vue';
|
|
34
|
38
|
import ExploreContainer from '@/components/ExploreContainer.vue';
|
|
35
|
39
|
import { defineComponent, onMounted } from 'vue';
|
|
36
|
40
|
import { GoogleAuth } from '@codetrix-studio/capacitor-google-auth';
|
|
37
|
|
-import { searchMat } from '@/composable/settings';
|
|
|
41
|
+import { searchMat, callUrl } from '@/composable/settings';
|
|
38
|
42
|
|
|
39
|
43
|
import { ref } from 'vue';
|
|
40
|
44
|
import SearchItem from '@/components/SearchItem.vue';
|
|
|
@@ -42,6 +46,7 @@ import SearchItem from '@/components/SearchItem.vue';
|
|
42
|
46
|
const results = ref();
|
|
43
|
47
|
const is_empty = ref(false);
|
|
44
|
48
|
const processing = ref(false)
|
|
|
49
|
+let next_url = null
|
|
45
|
50
|
const handleInput = async (event) => {
|
|
46
|
51
|
console.log("handleInput")
|
|
47
|
52
|
console.log(event)
|
|
|
@@ -58,6 +63,7 @@ const handleInput = async (event) => {
|
|
58
|
63
|
processing.value = false;
|
|
59
|
64
|
|
|
60
|
65
|
results.value = r.results
|
|
|
66
|
+ next_url = r.next
|
|
61
|
67
|
if(r.count == 0 ) {
|
|
62
|
68
|
is_empty.value = true;
|
|
63
|
69
|
}else {
|
|
|
@@ -66,4 +72,17 @@ const handleInput = async (event) => {
|
|
66
|
72
|
}
|
|
67
|
73
|
//test
|
|
68
|
74
|
}
|
|
|
75
|
+ const loadMore = async (ev: InfiniteScrollCustomEvent) => {
|
|
|
76
|
+ //setTimeout(() => ev.target.complete(), 500);
|
|
|
77
|
+ console.log("next url ", next_url)
|
|
|
78
|
+ if(next_url) {
|
|
|
79
|
+ let data = await callUrl(next_url)
|
|
|
80
|
+ console.log("data results", data.results)
|
|
|
81
|
+ results.value.push(data.results)
|
|
|
82
|
+ next_url = data.next
|
|
|
83
|
+ ev.target.complete()
|
|
|
84
|
+ }else {
|
|
|
85
|
+ ev.target.complete()
|
|
|
86
|
+ }
|
|
|
87
|
+ };
|
|
69
|
88
|
</script>
|