ColorButton.vue 970 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. padding: 0;
  34. }
  35. .color-btn-icon {
  36. width: 32px;
  37. font-size: 13px;
  38. color: #bfbfbf;
  39. }
  40. </style>