index.vue 2.6 KB

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