index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <!--浮动布局 -->
  2. <script lang="ts" setup>
  3. import { useSettingsStore } from '@/store/modules/settings'
  4. defineProps({
  5. fixedHeader: {
  6. type: Boolean,
  7. default() {
  8. return true
  9. },
  10. },
  11. showTabs: {
  12. type: Boolean,
  13. default() {
  14. return true
  15. },
  16. },
  17. })
  18. const settingsStore = useSettingsStore()
  19. const { foldSideBar, openSideBar } = settingsStore
  20. foldSideBar()
  21. onUnmounted(() => {
  22. openSideBar()
  23. })
  24. </script>
  25. <template>
  26. <div
  27. class="vab-layout-float"
  28. :class="{
  29. fixed: fixedHeader,
  30. 'no-tabs-bar': !showTabs,
  31. }"
  32. >
  33. <vab-side-bar layout="float" />
  34. <div class="vab-main">
  35. <div
  36. class="vab-layout-header"
  37. :class="{
  38. 'fixed-header': fixedHeader,
  39. }"
  40. >
  41. <vab-nav layout="float" />
  42. <vab-tabs v-show="showTabs" />
  43. </div>
  44. <vab-app-main />
  45. </div>
  46. </div>
  47. </template>
  48. <!--由于element-plus
  49. bug使用popper-append-to-body=false会导致多级路由无法显示,故所有菜单必须生成至body下,样式必须放到body下-->
  50. <style lang="scss" scoped>
  51. .vab-layout-float {
  52. :deep() {
  53. .vab-main {
  54. margin-left: $base-left-menu-width-min !important;
  55. .fixed-header {
  56. width: $base-right-content-width-min !important;
  57. }
  58. }
  59. }
  60. :deep() {
  61. .el-menu--collapse.el-menu li.el-sub-menu.is-active {
  62. .el-sub-menu__title {
  63. background-color: transparent !important;
  64. }
  65. > .el-sub-menu__title {
  66. background-color: var(--el-color-primary) !important;
  67. }
  68. }
  69. .vab-menu-children-height {
  70. height: auto !important;
  71. }
  72. .el-menu {
  73. &--vertical {
  74. .el-menu--popup-right-start {
  75. width: 335px !important;
  76. .el-sub-menu__title,
  77. .el-menu-item {
  78. float: left;
  79. width: 160px;
  80. min-width: 160px;
  81. margin: 0 0 5px 5px;
  82. border-radius: $base-border-radius;
  83. }
  84. }
  85. }
  86. }
  87. }
  88. }
  89. </style>