SideMenu.vue 3.7 KB

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