mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 01:47:39 -07:00
tab swipe fix finally
This commit is contained in:
parent
bf144902d9
commit
5231ee0385
1 changed files with 3 additions and 14 deletions
|
@ -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<InstanceType<typeof MkFolder>>();
|
||||
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) {
|
||||
|
|
Loading…
Reference in a new issue