2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2022-06-20 17:38:49 +09:00
|
|
|
<MkStickyContainer>
|
2022-06-22 16:29:21 +09:00
|
|
|
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
|
2022-07-01 23:33:47 +09:00
|
|
|
<div class="lznhrdub">
|
2022-09-14 08:36:58 +09:00
|
|
|
<MkSpacer :content-max="1200">
|
|
|
|
<swiper
|
|
|
|
:modules="[Virtual]"
|
|
|
|
:space-between="20"
|
|
|
|
:virtual="true"
|
2022-09-16 05:40:34 +09:00
|
|
|
:allow-touch-move="!(deviceKind === 'desktop' && !defaultStore.state.swipeOnDesktop)"
|
2022-09-14 08:36:58 +09:00
|
|
|
@swiper="setSwiperRef"
|
|
|
|
@slide-change="onSlideChange"
|
|
|
|
>
|
|
|
|
<swiper-slide>
|
|
|
|
<XFeatured/>
|
|
|
|
</swiper-slide>
|
|
|
|
<swiper-slide>
|
|
|
|
<XUsers/>
|
|
|
|
</swiper-slide>
|
|
|
|
</swiper>
|
|
|
|
</MkSpacer>
|
2022-07-01 23:33:47 +09:00
|
|
|
</div>
|
2022-06-20 17:38:49 +09:00
|
|
|
</MkStickyContainer>
|
2020-01-30 04:37:25 +09:00
|
|
|
</template>
|
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
<script lang="ts" setup>
|
2022-11-13 06:38:28 +09:00
|
|
|
import { computed, watch, onMounted } from 'vue';
|
2022-09-10 04:09:12 +09:00
|
|
|
import { Virtual } from 'swiper';
|
2022-10-26 03:54:08 +09:00
|
|
|
import { Swiper, SwiperSlide } from 'swiper/vue';
|
2022-07-01 23:33:47 +09:00
|
|
|
import XFeatured from './explore.featured.vue';
|
|
|
|
import XUsers from './explore.users.vue';
|
2022-09-14 08:36:58 +09:00
|
|
|
import type MkFolder from '@/components/MkFolder.vue';
|
2022-06-20 17:38:49 +09:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2022-09-16 02:43:48 +09:00
|
|
|
import { deviceKind } from '@/scripts/device-kind';
|
2022-06-20 17:38:49 +09:00
|
|
|
import { i18n } from '@/i18n';
|
2022-09-16 05:40:34 +09:00
|
|
|
import { defaultStore } from '@/store';
|
2022-09-10 04:09:12 +09:00
|
|
|
import 'swiper/scss';
|
|
|
|
import 'swiper/scss/virtual';
|
2022-06-20 17:38:49 +09:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
tag?: string;
|
|
|
|
}>();
|
|
|
|
|
2023-04-02 03:28:34 +09:00
|
|
|
const tabs = ['featured', 'users'];
|
2022-10-26 11:19:35 +09:00
|
|
|
let tab = $ref(tabs[0]);
|
|
|
|
watch($$(tab), () => (syncSlide(tabs.indexOf(tab))));
|
2022-09-10 04:09:12 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
let tagsEl = $ref<InstanceType<typeof MkFolder>>();
|
|
|
|
|
|
|
|
watch(() => props.tag, () => {
|
|
|
|
if (tagsEl) tagsEl.toggleContent(props.tag == null);
|
|
|
|
});
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => [{
|
2022-07-01 23:33:47 +09:00
|
|
|
key: 'featured',
|
2023-03-12 06:01:04 +09:00
|
|
|
icon: 'ph-lightning ph-bold ph-lg',
|
2022-07-01 23:33:47 +09:00
|
|
|
title: i18n.ts.featured,
|
2022-06-20 17:38:49 +09:00
|
|
|
}, {
|
2022-07-13 18:09:41 +09:00
|
|
|
key: 'users',
|
2023-03-12 06:01:04 +09:00
|
|
|
icon: 'ph-users ph-bold ph-lg',
|
2022-07-01 23:33:47 +09:00
|
|
|
title: i18n.ts.users,
|
2022-06-20 17:38:49 +09:00
|
|
|
}]);
|
|
|
|
|
|
|
|
definePageMetadata(computed(() => ({
|
|
|
|
title: i18n.ts.explore,
|
2023-03-12 06:01:04 +09:00
|
|
|
icon: 'ph-compass ph-bold ph-lg',
|
2022-06-20 17:38:49 +09:00
|
|
|
})));
|
2022-09-10 04:09:12 +09:00
|
|
|
|
|
|
|
let swiperRef = null;
|
|
|
|
|
|
|
|
function setSwiperRef(swiper) {
|
|
|
|
swiperRef = swiper;
|
2022-09-10 05:59:15 +09:00
|
|
|
syncSlide(tabs.indexOf(tab));
|
2022-09-10 04:09:12 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
function onSlideChange() {
|
2022-10-26 11:19:35 +09:00
|
|
|
tab = tabs[swiperRef.activeIndex];
|
2022-09-10 04:09:12 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
function syncSlide(index) {
|
|
|
|
swiperRef.slideTo(index);
|
|
|
|
}
|
|
|
|
|
2022-11-13 06:38:28 +09:00
|
|
|
onMounted(() => {
|
|
|
|
syncSlide(tabs.indexOf(swiperRef.activeIndex));
|
|
|
|
});
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
</script>
|