CheckboxButton.vue 822 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <button class="checkbox-button" :class="{ 'checked': checked }">
  3. <slot></slot>
  4. </button>
  5. </template>
  6. <script lang="ts">
  7. export default {
  8. name: 'checkbox-button',
  9. props: {
  10. checked: {
  11. type: Boolean,
  12. default: false,
  13. },
  14. },
  15. }
  16. </script>
  17. <style lang="scss" scoped>
  18. .checkbox-button {
  19. outline: 0;
  20. background-color: #fff;
  21. border: 1px solid #d9d9d9;
  22. font-size: 12px;
  23. padding: 0 15px;
  24. height: 32px;
  25. text-align: center;
  26. cursor: pointer;
  27. &:hover {
  28. color: $themeColor;
  29. }
  30. &.checked {
  31. color: #fff;
  32. background-color: $themeColor;
  33. border-color: $themeColor;
  34. &:hover {
  35. background: rgba($color: $themeColor, $alpha: .9);
  36. border-color: rgba($color: $themeColor, $alpha: .9);
  37. }
  38. }
  39. }
  40. </style>