Main.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <script setup>
  2. import { ref, reactive, computed, watch } from "vue";
  3. import { useRouter, useRoute } from "vue-router";
  4. import { useMainStore } from "@/stores/store";
  5. import axios from "axios";
  6. import moment from "moment";
  7. import Navbar from "@/components/Navbar.vue";
  8. const route = useRoute();
  9. const router = useRouter();
  10. const store = useMainStore();
  11. let title = ref("");
  12. title.value = route.meta.title;
  13. // 切換路由時取得 metaTitle
  14. router.beforeEach((to, from) => {
  15. title.value = to.meta.title;
  16. });
  17. console.log("this.$route.meta.", router);
  18. const path = computed(() => this.$route.matched[0].name);
  19. console.log("path", path);
  20. </script>
  21. <template>
  22. <div class="college-bg-img">
  23. <Navbar />
  24. <v-container fluid class="college-content pb-16 px-lg-0">
  25. <div class="college-banner">
  26. <img src="@/assets/img/college-group/banner.png" alt="" />
  27. <h1>{{ title }}</h1>
  28. </div>
  29. <div class="main-block">
  30. <router-view></router-view>
  31. </div>
  32. </v-container>
  33. </div>
  34. </template>
  35. <style lang="scss" scoped>
  36. .content {
  37. padding: 0;
  38. width: 90%;
  39. @media (max-width: 600px) {
  40. width: 85%;
  41. }
  42. .main-block {
  43. padding: 100px 80px;
  44. margin-top: -30%;
  45. background-color: #fff;
  46. @media (max-width: 960px) {
  47. padding: 100px 50px;
  48. }
  49. @media (max-width: 600px) {
  50. padding: 100px 20px;
  51. }
  52. h2 {
  53. font-size: 30px;
  54. font-weight: 500;
  55. line-height: 32px;
  56. margin-left: 10px;
  57. @media (max-width: 960px) {
  58. font-size: 24px;
  59. }
  60. @media (max-width: 600px) {
  61. margin-left: 0;
  62. margin-bottom: 50px;
  63. }
  64. }
  65. .title {
  66. margin: 80px 0;
  67. @media (max-width: 600px) {
  68. margin: 50px 0;
  69. }
  70. }
  71. .v-breadcrumbs {
  72. position: relative;
  73. z-index: 100;
  74. justify-content: flex-start;
  75. @media (max-width: 600px) {
  76. justify-content: center;
  77. }
  78. }
  79. }
  80. }
  81. </style>