SideMenu.vue 3.8 KB

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