From 5231ee038590783d134347caa711a1dda23c389d Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Tue, 25 Oct 2022 19:19:35 -0700 Subject: [PATCH] tab swipe fix finally --- packages/client/src/pages/explore.vue | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/packages/client/src/pages/explore.vue b/packages/client/src/pages/explore.vue index a9a707f04..9abcbec07 100644 --- a/packages/client/src/pages/explore.vue +++ b/packages/client/src/pages/explore.vue @@ -62,13 +62,9 @@ const props = defineProps<{ }>(); const tabs = ['featured', 'users', 'search']; +let tab = $ref(tabs[0]); +watch($$(tab), () => (syncSlide(tabs.indexOf(tab)))); -let tab = $computed({ - get: () => tabs[0], - set: (x) => { - syncSlide(tabs.indexOf(x)); - }, -}); let tagsEl = $ref>(); let searchQuery = $ref(null); let searchOrigin = $ref('combined'); @@ -109,20 +105,13 @@ definePageMetadata(computed(() => ({ let swiperRef = null; -const emit = defineEmits<{ - (ev: 'update:tab', key: string); -}>(); - function setSwiperRef(swiper) { swiperRef = swiper; syncSlide(tabs.indexOf(tab)); } function onSlideChange() { - let theTab = tabs[swiperRef.activeIndex]; - console.log(theTab); - emit('update:tab', theTab); - tab = theTab; + tab = tabs[swiperRef.activeIndex]; } function syncSlide(index) {