MainLayout.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <q-layout class="relative" view="hHh lpR fFf">
  3. <LeftMenuLayout v-model="leftDrawerOpen" />
  4. <q-page-container>
  5. <q-page>
  6. <q-scroll-area
  7. ref="scrollAreaRef"
  8. style="
  9. height: calc(100dvh - 50px - env(safe-area-inset-top)) !important;
  10. "
  11. >
  12. <router-view v-slot="{ Component }">
  13. <Transition>
  14. <component :is="Component" />
  15. </Transition>
  16. </router-view>
  17. </q-scroll-area>
  18. </q-page>
  19. </q-page-container>
  20. </q-layout>
  21. </template>
  22. <script setup>
  23. import { ref, useTemplateRef, watch } from "vue";
  24. import { useRoute } from "vue-router";
  25. import LeftMenuLayout from "src/components/geral/LeftMenuLayout.vue";
  26. defineOptions({
  27. name: "MainLayout",
  28. });
  29. const leftDrawerOpen = ref(false);
  30. const scrollAreaRef = useTemplateRef("scrollAreaRef");
  31. const route = useRoute();
  32. let oldValue = route.path;
  33. watch(route, (value) => {
  34. if (oldValue.path != value.path) {
  35. scrollAreaRef.value.setScrollPosition("vertical", 0, 250);
  36. scrollAreaRef.value.setScrollPosition("horizontal", 0, 250);
  37. }
  38. oldValue = value.path;
  39. });
  40. </script>
  41. <style scoped>
  42. .v-enter-active {
  43. opacity: 1;
  44. transition: all 0.15s ease-in;
  45. }
  46. .v-leave-active {
  47. opacity: 1;
  48. transition: all 0.15s ease-out;
  49. }
  50. .v-enter-from,
  51. .v-leave-to {
  52. opacity: 0;
  53. transition: all 0.15s ease-in;
  54. }
  55. .v-leave-to {
  56. transition: all 0.15s ease-out;
  57. }
  58. </style>