SideMenu.vue 3.3 KB

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