app.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <UApp>
  3. <AdminLoadingOverlay />
  4. <!-- 메인 페이지 헤더 -->
  5. <component :is="DynamicHeader" v-if="!isAdminPage && isIndexPage" />
  6. <!-- 서브 페이지 헤더 -->
  7. <component :is="DynamicSubHeader" v-if="!isAdminPage && !isIndexPage" />
  8. <NuxtLayout>
  9. <NuxtPage />
  10. </NuxtLayout>
  11. <component :is="DynamicFooter" v-if="!isAdminPage && isIndexPage" />
  12. </UApp>
  13. </template>
  14. <script setup>
  15. import { computed, defineAsyncComponent, watch } from "vue";
  16. import { useRoute } from "vue-router";
  17. import { useHead } from "#app";
  18. const route = useRoute();
  19. const config = useRuntimeConfig();
  20. // admin 페이지 체크
  21. const isAdminPage = computed(() => {
  22. return route.path.startsWith("/site-manager");
  23. });
  24. // index 페이지 체크 (홈)
  25. const isIndexPage = computed(() => {
  26. return route.path === "/";
  27. });
  28. // 파비콘 동적 설정
  29. const favicon = computed(() => {
  30. return "/favicon.ico";
  31. });
  32. // 타이틀 동적 설정
  33. const pageTitle = computed(() => {
  34. return "파이럿존";
  35. });
  36. useHead(() => ({
  37. title: pageTitle.value,
  38. link: [
  39. {
  40. rel: "icon",
  41. type: "image/x-icon",
  42. href: favicon.value,
  43. },
  44. ],
  45. }));
  46. // 동적 Header 컴포넌트
  47. const DynamicHeader = defineAsyncComponent(() => import(`~/components/header.vue`));
  48. // 동적 Header 컴포넌트
  49. const DynamicSubHeader = defineAsyncComponent(() => import(`~/components/subHeader.vue`));
  50. // 동적 Footer 컴포넌트
  51. const DynamicFooter = defineAsyncComponent(() => import(`~/components/footer.vue`));
  52. </script>
  53. <style setup>
  54. @import "tailwindcss";
  55. @import "@nuxt/ui";
  56. </style>