2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2023-04-08 09:01:42 +09:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header
|
|
|
|
><MkPageHeader
|
|
|
|
v-model:tab="tab"
|
|
|
|
:actions="headerActions"
|
|
|
|
:tabs="headerTabs"
|
|
|
|
/></template>
|
|
|
|
<div class="lznhrdub">
|
|
|
|
<MkSpacer :content-max="1200">
|
|
|
|
<swiper
|
|
|
|
:modules="[Virtual]"
|
|
|
|
:space-between="20"
|
|
|
|
:virtual="true"
|
|
|
|
:allow-touch-move="
|
|
|
|
!(
|
|
|
|
deviceKind === 'desktop' &&
|
|
|
|
!defaultStore.state.swipeOnDesktop
|
|
|
|
)
|
|
|
|
"
|
|
|
|
@swiper="setSwiperRef"
|
|
|
|
@slide-change="onSlideChange"
|
|
|
|
>
|
|
|
|
<swiper-slide>
|
2023-05-02 12:54:02 +09:00
|
|
|
<XUsers />
|
2023-04-08 09:01:42 +09:00
|
|
|
</swiper-slide>
|
|
|
|
<swiper-slide>
|
2023-05-02 12:54:02 +09:00
|
|
|
<XFeatured />
|
2023-04-08 09:01:42 +09:00
|
|
|
</swiper-slide>
|
|
|
|
</swiper>
|
|
|
|
</MkSpacer>
|
|
|
|
</div>
|
|
|
|
</MkStickyContainer>
|
2020-01-30 04:37:25 +09:00
|
|
|
</template>
|
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
<script lang="ts" setup>
|
2023-04-08 09:01:42 +09:00
|
|
|
import { computed, watch, onMounted } from "vue";
|
|
|
|
import { Virtual } from "swiper";
|
|
|
|
import { Swiper, SwiperSlide } from "swiper/vue";
|
|
|
|
import XFeatured from "./explore.featured.vue";
|
|
|
|
import XUsers from "./explore.users.vue";
|
|
|
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
|
|
|
import { deviceKind } from "@/scripts/device-kind";
|
|
|
|
import { i18n } from "@/i18n";
|
|
|
|
import { defaultStore } from "@/store";
|
|
|
|
import "swiper/scss";
|
|
|
|
import "swiper/scss/virtual";
|
2022-06-20 17:38:49 +09:00
|
|
|
|
2023-04-20 13:02:12 +09:00
|
|
|
const tabs = ["users", "featured"];
|
2022-10-26 11:19:35 +09:00
|
|
|
let tab = $ref(tabs[0]);
|
2023-04-08 09:01:42 +09:00
|
|
|
watch($$(tab), () => syncSlide(tabs.indexOf(tab)));
|
2022-09-10 04:09:12 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
2023-04-08 09:01:42 +09:00
|
|
|
const headerTabs = $computed(() => [
|
|
|
|
{
|
|
|
|
key: "users",
|
|
|
|
icon: "ph-users ph-bold ph-lg",
|
|
|
|
title: i18n.ts.users,
|
|
|
|
},
|
2023-05-02 12:54:02 +09:00
|
|
|
{
|
|
|
|
key: "featured",
|
|
|
|
icon: "ph-lightning ph-bold ph-lg",
|
|
|
|
title: i18n.ts.featured,
|
|
|
|
},
|
2023-04-08 09:01:42 +09:00
|
|
|
]);
|
2022-06-20 17:38:49 +09:00
|
|
|
|
2023-04-08 09:01:42 +09:00
|
|
|
definePageMetadata(
|
|
|
|
computed(() => ({
|
|
|
|
title: i18n.ts.explore,
|
|
|
|
icon: "ph-compass ph-bold ph-lg",
|
|
|
|
}))
|
|
|
|
);
|
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>
|