button.scss 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. .cl-button {
  2. display: inline-flex !important;
  3. align-items: center;
  4. justify-content: center;
  5. height: 66rpx;
  6. line-height: 1;
  7. vertical-align: middle;
  8. box-sizing: border-box;
  9. font-size: 26rpx;
  10. white-space: nowrap;
  11. margin: 0;
  12. padding: 0rpx 30rpx;
  13. overflow: visible;
  14. background-color: #fff;
  15. border-radius: 10rpx;
  16. /* #ifdef MP */
  17. cl-loading {
  18. display: inline-flex;
  19. align-items: center;
  20. }
  21. /* #endif */
  22. &__text {
  23. display: inline;
  24. color: #666;
  25. }
  26. &__icon {
  27. margin-right: 10rpx;
  28. }
  29. &.button-hover:not(&--text) {
  30. background-color: #f7f7f7;
  31. }
  32. [class^="cl-icon-"]:last-child {
  33. margin-left: 10rpx;
  34. }
  35. &[size="small"],
  36. &--small {
  37. height: 60rpx;
  38. padding: 0rpx 24rpx;
  39. }
  40. &[size="mini"],
  41. &--mini {
  42. font-size: 24rpx;
  43. padding: 0 14rpx;
  44. height: 54rpx;
  45. }
  46. &.is-round {
  47. border-radius: 100rpx;
  48. &::after {
  49. border-radius: 100rpx;
  50. }
  51. }
  52. &--text {
  53. background-color: transparent;
  54. .cl-button__text {
  55. color: $cl-color-primary;
  56. }
  57. &::after {
  58. border-width: 0;
  59. }
  60. }
  61. &.is-loading {
  62. opacity: 0.7;
  63. .cl-button__loading {
  64. display: inline-flex;
  65. align-items: center;
  66. }
  67. .cl-button__text {
  68. margin-left: 15rpx;
  69. }
  70. }
  71. &.is-fill {
  72. width: 100%;
  73. }
  74. &.is-plain {
  75. &::after {
  76. border-width: 1px;
  77. }
  78. }
  79. &.is-disabled {
  80. opacity: 0.5;
  81. }
  82. &.is-loading-mask {
  83. position: relative;
  84. &::after {
  85. content: "";
  86. background-color: rgba(0, 0, 0, 0.5);
  87. /* #ifdef MP-ALIPAY */
  88. height: 100%;
  89. width: 100%;
  90. position: absolute;
  91. left: 0;
  92. top: 0;
  93. /* #endif */
  94. }
  95. .cl-button__loading {
  96. position: absolute;
  97. left: auto;
  98. top: auto;
  99. z-index: 9;
  100. display: inline-flex;
  101. align-items: center;
  102. &-text {
  103. margin-left: 10rpx;
  104. }
  105. }
  106. }
  107. @mixin color($type, $color) {
  108. &.cl-button--#{$type} {
  109. background-color: $color;
  110. border-color: $color;
  111. .cl-button__text {
  112. color: #fff;
  113. }
  114. &::after {
  115. border-width: 0;
  116. }
  117. &.is-plain {
  118. background-color: #fff;
  119. .cl-button__text {
  120. color: rgba($color, 0.8);
  121. }
  122. &::after {
  123. border-width: 1px;
  124. border-color: rgba($color, 0.8);
  125. }
  126. }
  127. &.is-disabled {
  128. background-color: $color;
  129. }
  130. &.button-hover {
  131. background-color: rgba($color, 0.8);
  132. &.is-plain {
  133. .cl-button__text {
  134. color: #fff;
  135. }
  136. }
  137. }
  138. }
  139. &.is-shadow {
  140. box-shadow: 2rpx 4rpx 14rpx $color;
  141. }
  142. }
  143. @include color(primary, $cl-color-primary);
  144. @include color(success, $cl-color-success);
  145. @include color(error, $cl-color-error);
  146. @include color(warning, $cl-color-warning);
  147. @include color(info, $cl-color-info);
  148. }
  149. .cl-button + .cl-button,
  150. cl-button + cl-button {
  151. margin-left: 20rpx;
  152. }