SideMenu.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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 '../assets/style/bsTheme.scss';
  62. .side-catalog-wrap {
  63. .component-item-box {
  64. width: 100%;
  65. padding: 0px 16px;
  66. line-height: 36px;
  67. display: flex;
  68. justify-content: space-between;
  69. &:hover {
  70. cursor: pointer;
  71. }
  72. }
  73. }
  74. .side-catalog-wrap{
  75. // padding-top: 16px;
  76. width: 220px;
  77. // height: 100%;
  78. margin-bottom: 16px;
  79. box-sizing: border-box;
  80. color: var(--bs-el-title);
  81. background-color: var(--bs-background-2);
  82. .side-catalog-box{
  83. height: calc(100% - 50px);
  84. overflow-y: auto;
  85. .side-catalog-all{
  86. font-weight: bold;
  87. }
  88. .side-catalog-item{
  89. width: 100%;
  90. padding: 0px 16px;
  91. line-height: 36px;
  92. display: flex;
  93. justify-content: space-between;
  94. &:hover{
  95. cursor: pointer;
  96. }
  97. .el-icon-more{
  98. transform: rotate(90deg);
  99. color: var(--bs-el-title);
  100. font-weight: 400;
  101. }
  102. .active-icon-more{
  103. color:var(--bs-el-text);
  104. }
  105. .catalog-name{
  106. overflow:hidden;
  107. white-space: nowrap;
  108. text-overflow: ellipsis;
  109. -o-text-overflow:ellipsis;
  110. }
  111. .page-list-dropdown{
  112. opacity: 0;
  113. }
  114. .dropdown-show{
  115. opacity: 1;
  116. }
  117. }
  118. /*菜单激活时的样式*/
  119. .active-catalog{
  120. background-color: rgba(var(--bs-el-color-primary-active), 0.4);
  121. color: var(--bs-el-text);
  122. &::after{
  123. content: '';
  124. position: absolute;
  125. left: 0;
  126. width: 4px;
  127. height: 36px;
  128. background-color: var(--bs-el-color-primary);
  129. }
  130. }
  131. }
  132. .add-catalog-box{
  133. padding: 10px 0;
  134. box-sizing: border-box;
  135. display: flex;
  136. justify-content: center;
  137. align-items: center;
  138. border-radius: 10px;
  139. margin: 0 8px;
  140. &:hover{
  141. background-color: var(--bs-background-1);
  142. cursor: pointer;
  143. color: var(--bs-el-text);;
  144. }
  145. .el-icon-plus{
  146. padding: 0 5px;
  147. }
  148. }
  149. }
  150. .dropdown-menu-box{
  151. left: 50%;
  152. transform: translateX(-40%);
  153. width: 100px!important;
  154. /deep/.el-dropdown-menu__item{
  155. text-align: center;
  156. padding: 5px;
  157. }
  158. /deep/.popper__arrow{
  159. left: 50% !important;
  160. transform: translateX(-50%) !important;
  161. }
  162. }
  163. </style>