SideMenu.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. created () {
  39. const type = this.$route?.query?.type
  40. if (type) {
  41. this.componentHandle(this.componentList.find(item => item.type === type))
  42. } else {
  43. this.componentHandle(this.componentList[0])
  44. }
  45. },
  46. methods: {
  47. // 点击左侧组件
  48. componentHandle (com) {
  49. this.activeType = com.type
  50. this.$router.push({
  51. path: window.BS_CONFIG?.routers?.componentUrl || '/big-screen-components',
  52. query: {
  53. type: com.type
  54. }
  55. })
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="scss" scoped>
  61. @import '~packages/assets/style/bsTheme.scss';
  62. .side-catalog-wrap {
  63. .component-item-box {
  64. width: 100%;
  65. padding: 8px 16px;
  66. display: flex;
  67. justify-content: space-between;
  68. &:hover {
  69. cursor: pointer;
  70. }
  71. }
  72. }
  73. .side-catalog-wrap {
  74. padding-top: 16px;
  75. width: 220px;
  76. height: 100%;
  77. box-sizing: border-box;
  78. color: var(--bs-el-title);
  79. background-color: var(--bs-background-2);
  80. .side-catalog-box {
  81. height: calc(100% - 50px);
  82. overflow-y: auto;
  83. .side-catalog-all {
  84. font-weight: bold;
  85. }
  86. .side-catalog-item {
  87. width: 100%;
  88. padding: 8px 16px;
  89. display: flex;
  90. justify-content: space-between;
  91. &:hover {
  92. cursor: pointer;
  93. }
  94. .el-icon-more {
  95. transform: rotate(90deg);
  96. color: var(--bs-el-title);
  97. font-weight: 400;
  98. }
  99. .active-icon-more {
  100. color: var(--bs-el-text);
  101. }
  102. .catalog-name {
  103. overflow: hidden;
  104. white-space: nowrap;
  105. text-overflow: ellipsis;
  106. -o-text-overflow: ellipsis;
  107. }
  108. .page-list-dropdown {
  109. opacity: 0;
  110. }
  111. .dropdown-show {
  112. opacity: 1;
  113. }
  114. }
  115. /*菜单激活时的样式*/
  116. .active-catalog {
  117. background-image: linear-gradient(to right, var(--bs-el-color-primary), var(--bs-background-2));
  118. background-repeat: round;
  119. color: var(--bs-el-text);
  120. }
  121. }
  122. .add-catalog-box {
  123. padding: 10px 0;
  124. box-sizing: border-box;
  125. display: flex;
  126. justify-content: center;
  127. align-items: center;
  128. border-radius: 10px;
  129. margin: 0 8px;
  130. &:hover {
  131. background-color: var(--bs-background-1);
  132. cursor: pointer;
  133. color: var(--bs-el-text);
  134. ;
  135. }
  136. .el-icon-plus {
  137. padding: 0 5px;
  138. }
  139. }
  140. }
  141. .dropdown-menu-box {
  142. left: 50%;
  143. transform: translateX(-40%);
  144. width: 100px !important;
  145. /deep/.el-dropdown-menu__item {
  146. text-align: center;
  147. padding: 5px;
  148. }
  149. /deep/.popper__arrow {
  150. left: 50% !important;
  151. transform: translateX(-50%) !important;
  152. }
  153. }</style>