operate.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <el-popover
  3. class="operate-module"
  4. popper-class="liu-popover"
  5. placement="bottom-end"
  6. width="200"
  7. trigger="hover"
  8. @show="showFn"
  9. >
  10. <div class="operate-wrap">
  11. <div
  12. class="operate-list"
  13. v-for="(item, index) in btnData"
  14. :key="index"
  15. @click="item.click()"
  16. >
  17. <i class="iconfont" :class="[item.icon]"></i>
  18. <div class="btn-text">{{ item.text }}</div>
  19. </div>
  20. </div>
  21. <el-button
  22. type="text"
  23. icon="el-icon-s-operation"
  24. slot="reference"
  25. class="operate-btn"
  26. ></el-button>
  27. </el-popover>
  28. </template>
  29. <script>
  30. export default {
  31. name: 'operate-module',
  32. data() {
  33. return {};
  34. },
  35. props: {
  36. // 按钮列表
  37. btnData: {
  38. type: Array,
  39. default: () => []
  40. },
  41. // 触发后传入的数据
  42. item: {
  43. type: Object,
  44. default: () => {}
  45. }
  46. },
  47. methods: {
  48. showFn() {
  49. this.$emit('show', this.item);
  50. }
  51. }
  52. };
  53. </script>
  54. <style lang="scss">
  55. .liu-popover {
  56. background: rgba(0, 0, 0, 0.8);
  57. border-color: #000;
  58. .popper__arrow::after {
  59. border-bottom-color: rgba(0, 0, 0, 0.8) !important;
  60. }
  61. .operate-wrap {
  62. // background: rgba(0, 0, 0, 0.8);
  63. box-shadow: 0px 3px 6px 0px rgba(29, 29, 29, 0.7);
  64. border-radius: 10px;
  65. // width: max-content;
  66. height: 50px;
  67. @include disFlex(center, space-around);
  68. .operate-list {
  69. width: 30%;
  70. height: 50px;
  71. line-height: 24px;
  72. flex-shrink: 0;
  73. // padding: 0 24px;
  74. text-align: center;
  75. color: #fff;
  76. cursor: pointer;
  77. .iconfont {
  78. font-size: 16px;
  79. }
  80. .btn-text {
  81. transform: scale(0.8);
  82. margin-top: 2px;
  83. }
  84. &:hover {
  85. color: $mainColor;
  86. .iconfont {
  87. color: $mainColor;
  88. }
  89. }
  90. }
  91. }
  92. }
  93. .operate-module {
  94. .operate-btn {
  95. color: #666;
  96. font-size: 24px;
  97. &:hover {
  98. color: $mainColor;
  99. }
  100. }
  101. }
  102. </style>