ColorButton.vue 956 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <Button class="color-btn">
  3. <div class="color-block">
  4. <div class="content" :style="{ backgroundColor: color }"></div>
  5. </div>
  6. <IconPlatte class="color-btn-icon" />
  7. </Button>
  8. </template>
  9. <script lang="ts" setup>
  10. import Button from './Button.vue'
  11. defineProps<{
  12. color: string
  13. }>()
  14. </script>
  15. <style lang="scss" scoped>
  16. .color-btn {
  17. width: 100%;
  18. display: flex !important;
  19. align-items: center;
  20. justify-content: center;
  21. padding: 0 !important;
  22. }
  23. .color-block {
  24. height: 20px;
  25. margin-left: 8px;
  26. flex: 1;
  27. outline: 1px dashed rgba($color: #666, $alpha: .12);
  28. background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAEBJREFUOE9jfPbs2X8GIoCkpCQRqhgYGEcNxBlOo2GIM2iGQLL5//8/UTnl+fPnxOWUUQNxhtNoGOLOKYM+2QAAh2Nq10DwkukAAAAASUVORK5CYII=);
  29. }
  30. .content {
  31. width: 100%;
  32. height: 100%;
  33. }
  34. .color-btn-icon {
  35. width: 32px;
  36. font-size: 13px;
  37. color: #bfbfbf;
  38. }
  39. </style>