SideMenu.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <div class="side-catalog-wrap">
  3. <el-scrollbar class="side-catalog-box">
  4. <div
  5. v-for="(com, index) in componentList"
  6. :key="index"
  7. class="component-item-box"
  8. :class="{ 'active-catalog': activeType === com.type }"
  9. @click="componentHandle(com)"
  10. >
  11. {{ com.name }}
  12. </div>
  13. </el-scrollbar>
  14. </div>
  15. </template>
  16. <script>
  17. export default {
  18. components: {},
  19. data () {
  20. return {
  21. componentList: [
  22. {
  23. name: '自定义组件',
  24. type: 'component'
  25. },
  26. {
  27. name: '业务组件',
  28. type: 'bizComponent'
  29. },
  30. {
  31. name: '系统组件',
  32. type: 'system'
  33. }
  34. ],
  35. activeType: 'component'
  36. }
  37. },
  38. mounted () {
  39. const type = this.$route?.query?.type
  40. if (type) {
  41. this.activeType = type
  42. this.$nextTick(() => {
  43. this.$emit('getPageInfo', type)
  44. })
  45. }
  46. },
  47. methods: {
  48. // 点击左侧组件
  49. componentHandle (com) {
  50. this.activeType = com.type
  51. this.$emit('getPageInfo', com.type)
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss" scoped>
  57. @import '~packages/assets/style/bsTheme.scss';
  58. .side-catalog-wrap {
  59. .component-item-box {
  60. width: 100%;
  61. padding: 8px 16px;
  62. display: flex;
  63. justify-content: space-between;
  64. &:hover {
  65. cursor: pointer;
  66. }
  67. }
  68. }
  69. .side-catalog-wrap {
  70. padding-top: 16px;
  71. width: 220px;
  72. height: 100%;
  73. box-sizing: border-box;
  74. color: var(--bs-el-title);
  75. background-color: var(--bs-background-2);
  76. .side-catalog-box {
  77. height: calc(100% - 50px);
  78. overflow-y: auto;
  79. .side-catalog-all {
  80. font-weight: bold;
  81. }
  82. .side-catalog-item {
  83. width: 100%;
  84. padding: 8px 16px;
  85. display: flex;
  86. justify-content: space-between;
  87. &:hover {
  88. cursor: pointer;
  89. }
  90. .el-icon-more {
  91. transform: rotate(90deg);
  92. color: var(--bs-el-title);
  93. font-weight: 400;
  94. }
  95. .active-icon-more {
  96. color: var(--bs-el-text);
  97. }
  98. .catalog-name {
  99. overflow: hidden;
  100. white-space: nowrap;
  101. text-overflow: ellipsis;
  102. -o-text-overflow: ellipsis;
  103. }
  104. .page-list-dropdown {
  105. opacity: 0;
  106. }
  107. .dropdown-show {
  108. opacity: 1;
  109. }
  110. }
  111. /*菜单激活时的样式*/
  112. .active-catalog {
  113. background-image: linear-gradient(to right, var(--bs-el-color-primary), var(--bs-background-2));
  114. background-repeat: round;
  115. color: var(--bs-el-text);
  116. }
  117. }
  118. .add-catalog-box {
  119. padding: 10px 0;
  120. box-sizing: border-box;
  121. display: flex;
  122. justify-content: center;
  123. align-items: center;
  124. border-radius: 10px;
  125. margin: 0 8px;
  126. &:hover {
  127. background-color: var(--bs-background-1);
  128. cursor: pointer;
  129. color: var(--bs-el-text);
  130. ;
  131. }
  132. .el-icon-plus {
  133. padding: 0 5px;
  134. }
  135. }
  136. }
  137. .dropdown-menu-box {
  138. left: 50%;
  139. transform: translateX(-40%);
  140. width: 100px !important;
  141. /deep/.el-dropdown-menu__item {
  142. text-align: center;
  143. padding: 5px;
  144. }
  145. /deep/.popper__arrow {
  146. left: 50% !important;
  147. transform: translateX(-50%) !important;
  148. }
  149. }</style>