邃芒慧影管理端
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

120 linhas
2.4 KiB

  1. <template>
  2. <div>
  3. <!-- 侧边栏 -->
  4. <div><Sidebar class="sidebar-container" /></div>
  5. <!-- 页面主体 -->
  6. <div>
  7. <!-- nav -->
  8. <div><navbar /></div>
  9. <!-- 页面主体 -->
  10. <div><app-main /></div>
  11. </div>
  12. </div>
  13. </template>
  14. <script setup lang="ts">
  15. import { computed, watchEffect } from "vue";
  16. import { useWindowSize } from "@vueuse/core";
  17. import { AppMain, Navbar } from "./components/index";
  18. import SignSucceed from "../views/signSucceed/index.vue";
  19. import Sidebar from "./components/Sidebar/index.vue";
  20. import { useAppStore } from "@/store/modules/app";
  21. import { useSettingsStore } from "@/store/modules/settings";
  22. import { useRoute, useRouter } from "vue-router";
  23. const route = useRoute();
  24. const { params } = route;
  25. const { width } = useWindowSize();
  26. /**
  27. * 响应式布局容器固定宽度
  28. *
  29. * 大屏(>=1200px)
  30. * 中屏(>=992px)
  31. * 小屏(>=768px)
  32. */
  33. const WIDTH = 992;
  34. const appStore = useAppStore();
  35. const settingsStore = useSettingsStore();
  36. const fixedHeader = computed(() => settingsStore.fixedHeader);
  37. const showTagsView = computed(() => settingsStore.tagsView);
  38. const showSettings = computed(() => settingsStore.showSettings);
  39. const classObj = computed(() => ({
  40. hideSidebar: !appStore.sidebar.opened,
  41. openSidebar: appStore.sidebar.opened,
  42. withoutAnimation: appStore.sidebar.withoutAnimation,
  43. mobile: appStore.device === "mobile",
  44. }));
  45. watchEffect(() => {
  46. if (width.value < WIDTH) {
  47. appStore.toggleDevice("mobile");
  48. appStore.closeSideBar(true);
  49. } else {
  50. appStore.toggleDevice("desktop");
  51. if (width.value >= 1200) {
  52. //大屏
  53. appStore.openSideBar(true);
  54. } else {
  55. appStore.closeSideBar(true);
  56. }
  57. }
  58. });
  59. function handleOutsideClick() {
  60. appStore.closeSideBar(false);
  61. }
  62. onMounted(() => {});
  63. </script>
  64. <style lang="scss" scoped>
  65. .app-wrapper {
  66. &::after {
  67. display: table;
  68. clear: both;
  69. content: "";
  70. }
  71. position: relative;
  72. width: 100%;
  73. height: 100%;
  74. e &.mobile.openSidebar {
  75. position: fixed;
  76. top: 0;
  77. }
  78. }
  79. .fixed-header {
  80. position: fixed;
  81. top: 0;
  82. right: 0;
  83. z-index: 9;
  84. width: calc(100% - #{$sideBarWidth});
  85. transition: width 0.28s;
  86. }
  87. .hideSidebar .fixed-header {
  88. width: calc(100% - 54px);
  89. }
  90. .mobile .fixed-header {
  91. width: 100%;
  92. }
  93. .drawer-bg {
  94. position: absolute;
  95. top: 0;
  96. z-index: 999;
  97. width: 100%;
  98. height: 100%;
  99. // background: #1b213a;
  100. background: #000;
  101. opacity: 0.3;
  102. }
  103. </style>