operate-line.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <div class="operate-line-module" :class="[isModify ? 'witer' : 'back']" :style="{bottom: bottom + 'rpx', left: left + 'rpx'}">
  3. <div class="operate-list" :style="{height: listHei + 'rpx'}" v-for="(item, index) in btnData" :key="index" @click="clickFn(item, index)">
  4. <div v-if="isModify" class="icon-del" @click.stop="delFn(index)">
  5. <i class="iconfont iconguanbi"></i>
  6. </div>
  7. <div class="btn-text">{{ item.name }}</div>
  8. </div>
  9. <div v-if="isModify" class="operate-list" :style="{height: listHei + 'rpx'}" @click="addFn">
  10. <i class="iconfont icontupiantianjia icon-add"></i>
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. name: 'operate-line-module',
  17. props: {
  18. // 是否可以操作
  19. isModify: {
  20. type: Boolean,
  21. default: false
  22. },
  23. bottom: {
  24. type: Number,
  25. default: 480
  26. },
  27. left: {
  28. type: Number,
  29. default: 40
  30. },
  31. // 按钮列表
  32. btnData: {
  33. type: Array,
  34. default: () => []
  35. },
  36. // 按钮列表高度
  37. listHei: {
  38. type: Number,
  39. default: 100
  40. }
  41. },
  42. methods: {
  43. addFn() {
  44. this.$emit('add')
  45. },
  46. delFn(index) {
  47. this.$emit('del', index)
  48. },
  49. clickFn(item, index) {
  50. if (item.click) {
  51. item.click()
  52. return false
  53. }
  54. this.$emit('clickFn', index)
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. .operate-line-module {
  61. position: absolute;
  62. border-radius: 10px;
  63. padding: 0 10px;
  64. width: 170px;
  65. z-index: 999;
  66. &.witer {
  67. background-color: #fff;
  68. &::after {
  69. border-color: #fff transparent transparent transparent !important;
  70. }
  71. }
  72. &.back {
  73. color: #fff;
  74. background: rgba(0, 0, 0, 0.8);
  75. box-shadow: 0px 3px 6px 0px rgba(29, 29, 29, 0.7);
  76. &::after {
  77. opacity: 0.8;
  78. border-color: #000 transparent transparent transparent !important;
  79. }
  80. }
  81. &::after {
  82. content: '';
  83. position: absolute;
  84. bottom: -28px;
  85. left: 80px;
  86. width: 0;
  87. height: 0;
  88. // top: 16px;
  89. border: 14px solid #fff;
  90. }
  91. // 操作列表
  92. .operate-list {
  93. @include disFlex(center, center);
  94. border-top: 1px solid $borderColor;
  95. position: relative;
  96. &:first-child {
  97. border-top: 0;
  98. }
  99. .icon-del {
  100. position: absolute;
  101. top: 12px;
  102. right: 0;
  103. .iconfont {
  104. font-size: 24px;
  105. transform: scale(0.6);
  106. }
  107. }
  108. .icon-add {
  109. color: #09bb07;
  110. font-size: 24px;
  111. }
  112. }
  113. }
  114. </style>