SideMenu.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. background-color: rgba(var(--bs-el-color-primary-active), 0.4);
  117. color: var(--bs-el-text);
  118. &::after{
  119. content: '';
  120. position: absolute;
  121. left: 0;
  122. width: 4px;
  123. height: 36px;
  124. background-color: var(--bs-el-color-primary);
  125. }
  126. }
  127. }
  128. .add-catalog-box{
  129. padding: 10px 0;
  130. box-sizing: border-box;
  131. display: flex;
  132. justify-content: center;
  133. align-items: center;
  134. border-radius: 10px;
  135. margin: 0 8px;
  136. &:hover{
  137. background-color: var(--bs-background-1);
  138. cursor: pointer;
  139. color: var(--bs-el-text);;
  140. }
  141. .el-icon-plus{
  142. padding: 0 5px;
  143. }
  144. }
  145. }
  146. .dropdown-menu-box{
  147. left: 50%;
  148. transform: translateX(-40%);
  149. width: 100px!important;
  150. /deep/.el-dropdown-menu__item{
  151. text-align: center;
  152. padding: 5px;
  153. }
  154. /deep/.popper__arrow{
  155. left: 50% !important;
  156. transform: translateX(-50%) !important;
  157. }
  158. }
  159. </style>