default.vue 729 B

12345678910111213141516171819202122232425262728293031
  1. <template>
  2. <div
  3. ref="globalWindow"
  4. class="text-foreground flex flex-col w-screen h-screen bg-background-200 overflow-y-hidden select-none"
  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 { updateColors } from '~/composables/useColors'
  16. import { useSideBar } from '~/store/useSideBar'
  17. const store = useSideBar()
  18. const globalWindow = ref(null)
  19. const { direction, lengthX } = useSwipe(globalWindow, {
  20. onSwipeEnd() {
  21. if (direction.value === 'right' && lengthX.value < -100) store.show()
  22. },
  23. })
  24. onMounted(() => {
  25. updateColors('#212121')
  26. })
  27. </script>