✨ Implement day navigation gestures with Swiper.js
This commit is contained in:
12
src/App.vue
12
src/App.vue
@ -5,7 +5,6 @@ import BottomNavbar from "./components/bottom-navbar.vue";
|
||||
import DateSelector from "./components/date-selector.vue";
|
||||
import LoadingElement from "./components/loading-element.vue";
|
||||
import { loading } from "./store";
|
||||
import { previousDay, nextDay } from "./util";
|
||||
import { computed } from "vue";
|
||||
|
||||
const route = useRoute();
|
||||
@ -15,19 +14,13 @@ const isDataView = computed(() => {
|
||||
routeName.value != "title.settings" && routeName.value != "title.login"
|
||||
);
|
||||
});
|
||||
|
||||
function swipeHandler(direction) {
|
||||
if (!isDataView.value) return;
|
||||
if (direction == "left") nextDay();
|
||||
else if (direction == "right") previousDay();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="app">
|
||||
<TitleBar />
|
||||
<DateSelector v-show="isDataView" />
|
||||
<div class="center" v-touch:swipe="swipeHandler">
|
||||
<div class="center">
|
||||
<main>
|
||||
<LoadingElement :active="loading" v-show="isDataView" />
|
||||
<RouterView />
|
||||
@ -57,18 +50,17 @@ body {
|
||||
.app {
|
||||
display: grid;
|
||||
grid-template-rows: auto auto 1fr;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.center {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
overflow-y: auto;
|
||||
overflow: overlay;
|
||||
}
|
||||
|
||||
main {
|
||||
width: 100%;
|
||||
max-width: 900px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user