refactor: ✨ Swiper, no swiping! :fox:
Swiper everywhere, attempt to sync to header bar
This commit is contained in:
parent
37b7c4485c
commit
e4861bcf0b
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "calckey",
|
"name": "calckey",
|
||||||
"version": "12.118.1-calc.2-beta.2-rc.5",
|
"version": "12.118.1-calc.2-beta.2-rc.6",
|
||||||
"codename": "aqua",
|
"codename": "aqua",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
{{ i18n.ts.newNoteRecived }}
|
{{ i18n.ts.newNoteRecived }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!isMobile" class="tl _block">
|
<!-- <div v-if="!isMobile" class="tl _block">
|
||||||
<XTimeline
|
<XTimeline
|
||||||
ref="tl"
|
ref="tl"
|
||||||
:key="src"
|
:key="src"
|
||||||
@ -34,13 +34,14 @@
|
|||||||
:sound="true"
|
:sound="true"
|
||||||
@queue="queueUpdated"
|
@queue="queueUpdated"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div> *v-else on next div* -->
|
||||||
<div v-else class="tl _block">
|
<div class="tl _block">
|
||||||
<swiper
|
<swiper
|
||||||
:modules="[Pagination, Virtual]"
|
:modules="[Pagination, Virtual]"
|
||||||
:space-between="20"
|
:space-between="20"
|
||||||
:virtual="true"
|
:virtual="true"
|
||||||
@swiper="setSwiperRef"
|
@swiper="setSwiperRef"
|
||||||
|
@slide-change="onSlideChange"
|
||||||
>
|
>
|
||||||
<swiper-slide
|
<swiper-slide
|
||||||
v-for="index in timelines"
|
v-for="index in timelines"
|
||||||
@ -79,7 +80,7 @@ import { definePageMetadata } from '@/scripts/page-metadata';
|
|||||||
import { deviceKind } from '@/scripts/device-kind';
|
import { deviceKind } from '@/scripts/device-kind';
|
||||||
import 'swiper/scss';
|
import 'swiper/scss';
|
||||||
import 'swiper/scss/pagination';
|
import 'swiper/scss/pagination';
|
||||||
import 'swiper/css/virtual';
|
import 'swiper/scss/virtual';
|
||||||
|
|
||||||
const XTutorial = defineAsyncComponent(() => import('./timeline.tutorial.vue'));
|
const XTutorial = defineAsyncComponent(() => import('./timeline.tutorial.vue'));
|
||||||
|
|
||||||
@ -148,7 +149,7 @@ async function chooseAntenna(ev: MouseEvent): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function saveSrc(
|
function saveSrc(
|
||||||
newSrc: 'home' | 'local' | 'recommended' | 'social' | 'global'
|
newSrc: 'home' | 'local' | 'recommended' | 'social' | 'global',
|
||||||
): void {
|
): void {
|
||||||
defaultStore.set('tl', {
|
defaultStore.set('tl', {
|
||||||
...defaultStore.state.tl,
|
...defaultStore.state.tl,
|
||||||
@ -271,13 +272,17 @@ if (isGlobalTimelineAvailable) {
|
|||||||
|
|
||||||
let swiperRef = null;
|
let swiperRef = null;
|
||||||
|
|
||||||
const setSwiperRef = (swiper) => {
|
function setSwiperRef(swiper) {
|
||||||
swiperRef = swiper;
|
swiperRef = swiper;
|
||||||
};
|
}
|
||||||
|
|
||||||
const slideTo = (index) => {
|
function onSlideChange() {
|
||||||
|
if (swiperRef) {
|
||||||
|
const index = swiperRef.activeIndex;
|
||||||
|
saveSrc(timelines[swiperRef.activeIndex]);
|
||||||
swiperRef.slideTo(index - 1, 0);
|
swiperRef.slideTo(index - 1, 0);
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user