default.vue 614 B

1234567891011121314151617181920212223242526
  1. <template>
  2. <div
  3. ref="globalWindow"
  4. class="text-foreground flex flex-col w-screen h-screen bg-background-200 overflow-y-hidden"
  5. >
  6. <BaseSideBar />
  7. <BaseHeader />
  8. <main class="flex-auto overflow-y-scroll">
  9. <slot />
  10. </main>
  11. </div>
  12. </template>
  13. <script setup lang="ts">
  14. import { useSwipe } from '@vueuse/core'
  15. import { useSideBar } from '~/store/useSideBar'
  16. const store = useSideBar()
  17. const globalWindow = ref(null)
  18. const { direction, lengthX } = useSwipe(globalWindow, {
  19. onSwipeEnd() {
  20. if (direction.value === 'right' && lengthX.value < -100) store.show()
  21. },
  22. })
  23. </script>