SideMenu.vue 3.3 KB

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