index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <!-- 左侧所有组件的展示列表 -->
  3. <ContentBox
  4. class="go-content-charts"
  5. :class="{ scoped: !getCharts }"
  6. title="组件"
  7. :depth="1"
  8. :backIcon="false"
  9. >
  10. <template #icon>
  11. <n-icon size="14" :depth="2">
  12. <BarChartIcon />
  13. </n-icon>
  14. </template>
  15. <!-- 图表 -->
  16. <aside>
  17. <div class="menu-width-box">
  18. <n-menu
  19. class="menu-width"
  20. v-model:value="selectValue"
  21. :options="menuOptions"
  22. :icon-size="16"
  23. :indent="18"
  24. @update:value="clickItemHandle"
  25. />
  26. <div class="menu-component-box">
  27. <Skeleton
  28. :load="!selectOptions"
  29. round
  30. text
  31. :repeat="2"
  32. style="width: 90%;"
  33. />
  34. <OptionContent
  35. v-if="selectOptions"
  36. :selectOptions="selectOptions"
  37. :key="selectValue"
  38. />
  39. </div>
  40. </div>
  41. </aside>
  42. </ContentBox>
  43. </template>
  44. <script setup lang="ts">
  45. import { reactive, ref, toRefs } from 'vue'
  46. import { ContentBox } from '../ContentBox/index'
  47. import { OptionContent } from './components/OptionContent'
  48. import {
  49. getCharts,
  50. BarChartIcon,
  51. themeColor,
  52. selectOptions,
  53. selectValue,
  54. clickItemHandle,
  55. menuOptions
  56. } from './hooks/asideHook'
  57. </script>
  58. <style lang="scss" scoped>
  59. /* 整体宽度 */
  60. $width: 330px;
  61. /* 列表的宽度 */
  62. $widthScoped: 65px;
  63. /* 此高度与 ContentBox 组件关联*/
  64. $topHeight: 36px;
  65. @include go(content-charts) {
  66. width: $width;
  67. @extend .go-transition;
  68. &.scoped,
  69. .menu-width {
  70. width: $widthScoped;
  71. }
  72. .menu-width-box {
  73. display: flex;
  74. height: calc(100vh - #{$--header-height} - #{$topHeight});
  75. .menu-width {
  76. flex-shrink: 0;
  77. @include filter-bg-color('background-color2');
  78. }
  79. .menu-component-box {
  80. flex-shrink: 0;
  81. width: $width - $widthScoped;
  82. overflow: hidden;
  83. }
  84. }
  85. @include deep() {
  86. .menu-width {
  87. .n-menu-item {
  88. height: auto !important;
  89. &.n-menu-item--selected {
  90. &::after {
  91. content: '';
  92. position: absolute;
  93. left: 2px;
  94. top: 0;
  95. height: 100%;
  96. width: 3px;
  97. background-color: v-bind('themeColor');
  98. border-top-right-radius: 3px;
  99. border-bottom-right-radius: 3px;
  100. }
  101. }
  102. .n-menu-item-content {
  103. display: flex;
  104. flex-direction: column;
  105. padding: 6px 12px !important;
  106. font-size: 14px !important;
  107. }
  108. .n-menu-item-content__icon {
  109. font-size: 18px !important;
  110. margin-right: 0 !important;
  111. }
  112. }
  113. }
  114. }
  115. }
  116. </style>