diff --git a/src/mixins.ts b/src/mixins.ts index 6e77bb8..6e8c04b 100644 --- a/src/mixins.ts +++ b/src/mixins.ts @@ -106,8 +106,9 @@ export async function followersStreaming(streamers: string[], cursor: number): P let res: string[] = [] - const payloadData = streamers.slice(cursor, cursor + 35) + const payloadData = streamers.slice(cursor * 35, (cursor * 35) + 35) + console.log(payloadData) const payload = { streamers: payloadData } diff --git a/src/views/HomepageView.vue b/src/views/HomepageView.vue index 29daedd..417099c 100644 --- a/src/views/HomepageView.vue +++ b/src/views/HomepageView.vue @@ -15,13 +15,15 @@ export default { async setup() { let data = ref() let status = ref<'ok' | 'error'>() + let followingStreaming = ref() let following = ref() return { data, status, filterTags: '', - following + following, + followingStreaming } }, methods: { @@ -70,13 +72,13 @@ export default { async handleFollowingScroll(event: UIEvent) { let el = event.target as HTMLUListElement let fullyScrolled = el.scrollLeft === el.scrollWidth - el.clientWidth - console.log(el) if (!fullyScrolled) return - if (!this.following) return - let offset = this.following.length / 35 - let newFollowers = await followersStreaming(getFollows(), offset) - this.following = [...this.following, ...newFollowers] + + let offset = Math.floor(this.following.length / 35) + console.log(offset) + let newFollowers = await followersStreaming(this.following, offset) + this.followingStreaming = [...this.following, ...newFollowers] } }, async mounted() { @@ -91,7 +93,8 @@ export default { this.data = data }) - this.following = await followersStreaming(getFollows(), 0) + this.followingStreaming = await followersStreaming(getFollows(), 0) + this.following = await getFollows() }, components: { StreamPreviewVue, @@ -118,7 +121,7 @@ export default { class="flex flex-nowrap justify-begin overflow-x-scroll overflow-y-hidden space-x-2 mt-1 h-[19rem] items-center" @scroll="handleFollowingScroll" > -
  • +