CButton.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <button class="c-button" :class="disabled ? 'disabled' : ''" @click="$emit('click')">
  3. <span v-if="icon" class="icon">{{icon}}</span>
  4. <slot></slot>
  5. </button>
  6. </template>
  7. <script>
  8. export default {
  9. props: ['icon', 'disabled']
  10. }
  11. </script>
  12. <style lang="scss" scoped>
  13. @import '~@/style/theme.scss';
  14. button {
  15. border: none;
  16. outline: none;
  17. background: transparent;
  18. cursor: pointer;
  19. -webkit-tap-highlight-color: transparent;
  20. display: block;
  21. min-width: 120px;
  22. height: 40px;
  23. background: $theme-blue;
  24. color: white;
  25. border-radius: 8px;
  26. font-size: 14px;
  27. padding: 0 16px;
  28. font-weight: bold;
  29. &:hover {
  30. background: darken($theme-blue, 5);
  31. }
  32. &:active {
  33. background: darken($theme-blue, 10);
  34. }
  35. }
  36. .secondary {
  37. color: $theme-blue;
  38. background: $theme-blue-transparent;
  39. &:hover {
  40. background: darken($theme-blue-transparent, 5);
  41. }
  42. &:active {
  43. background: darken($theme-blue-transparent, 10);
  44. }
  45. }
  46. .warning {
  47. color: $theme-orange;
  48. background: $theme-orange-transparent;
  49. &:hover {
  50. background: darken($theme-orange-transparent, 5);
  51. }
  52. &:active {
  53. background: darken($theme-orange-transparent, 10);
  54. }
  55. }
  56. .error {
  57. color: $theme-red;
  58. background: $theme-red-transparent;
  59. &:hover {
  60. background: darken($theme-red-transparent, 5);
  61. }
  62. &:active {
  63. background: darken($theme-red-transparent, 10);
  64. }
  65. }
  66. .disabled {
  67. background: #daeafa;
  68. color: white;
  69. cursor: not-allowed;
  70. &:hover {
  71. background: #daeafa;
  72. }
  73. &:active {
  74. background: #daeafa;
  75. }
  76. }
  77. </style>