index.less 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. @import '../style/var';
  2. .van-button {
  3. display: inline-block;
  4. position: relative;
  5. padding: 0;
  6. height: @button-default-height;
  7. line-height: @button-default-line-height;
  8. font-size: @button-default-font-size;
  9. border-radius: @button-border-radius;
  10. text-align: center;
  11. box-sizing: border-box;
  12. -webkit-appearance: none;
  13. -webkit-text-size-adjust: 100%;
  14. &::before {
  15. content: " ";
  16. position: absolute;
  17. top: 50%;
  18. left: 50%;
  19. opacity: 0;
  20. width: 100%;
  21. height: 100%;
  22. border: inherit;
  23. border-color: @black;
  24. background-color: @black;
  25. border-radius: inherit; /* inherit parent's border radius */
  26. transform: translate(-50%, -50%);
  27. }
  28. &:active::before {
  29. opacity: .1;
  30. }
  31. &--loading,
  32. &--disabled {
  33. &::before {
  34. display: none;
  35. }
  36. }
  37. &--default {
  38. color: @button-default-color;
  39. background-color: @button-default-background-color;
  40. border: @button-border-width solid @button-default-border-color;
  41. }
  42. &--primary {
  43. color: @button-primary-color;
  44. background-color: @button-primary-background-color;
  45. border: @button-border-width solid @button-primary-border-color;
  46. }
  47. &--info {
  48. color: @button-info-color;
  49. background-color: @button-info-background-color;
  50. border: @button-border-width solid @button-info-border-color;
  51. }
  52. &--danger {
  53. color: @button-danger-color;
  54. background-color: @button-danger-background-color;
  55. border: @button-border-width solid @button-danger-border-color;
  56. }
  57. &--warning {
  58. color: @button-warning-color;
  59. background-color: @button-warning-background-color;
  60. border: @button-border-width solid @button-warning-border-color;
  61. }
  62. &--plain {
  63. background-color: @button-plain-background-color;
  64. &.van-button--primary {
  65. color: @button-primary-background-color;
  66. }
  67. &.van-button--info {
  68. color: @button-info-background-color;
  69. }
  70. &.van-button--danger {
  71. color: @button-danger-background-color;
  72. }
  73. &.van-button--warning {
  74. color: @button-warning-background-color;
  75. }
  76. }
  77. &--large {
  78. width: 100%;
  79. height: @button-large-height;
  80. line-height: @button-large-line-height;
  81. }
  82. &--normal {
  83. padding: 0 15px;
  84. font-size: @button-normal-font-size;
  85. }
  86. &--small {
  87. padding: 0 8px;
  88. height: @button-small-height;
  89. min-width: @button-small-min-width;
  90. font-size: @button-small-font-size;
  91. line-height: @button-small-line-height;
  92. }
  93. &--loading {
  94. .van-loading {
  95. display: inline-block;
  96. }
  97. }
  98. &--mini {
  99. display: inline-block;
  100. height: @button-mini-height;
  101. min-width: @button-mini-min-width;
  102. font-size: @button-mini-font-size;
  103. line-height: @button-mini-line-height;
  104. & + .van-button--mini {
  105. margin-left: 5px;
  106. }
  107. }
  108. &--block {
  109. width: 100%;
  110. display: block;
  111. }
  112. &--bottom-action {
  113. border: 0;
  114. width: 100%;
  115. height: 50px;
  116. font-size: 16px;
  117. line-height: 50px;
  118. border-radius: 0;
  119. color: @button-bottom-action-default-color;
  120. background-color: @button-bottom-action-default-background-color;
  121. &.van-button--primary {
  122. background-color: @button-bottom-action-primary-background-color;
  123. }
  124. }
  125. &--disabled {
  126. opacity: @button-disabled-opacity;
  127. }
  128. &--round {
  129. border-radius: @button-round-border-radius;
  130. }
  131. &--square {
  132. border-radius: 0;
  133. }
  134. &__loading-text {
  135. margin-left: 5px;
  136. display: inline-block;
  137. vertical-align: middle;
  138. }
  139. &--hairline {
  140. border-width: 0;
  141. &::after {
  142. border-color: inherit;
  143. border-radius: @button-border-radius * 2;
  144. }
  145. &.van-button--round::after {
  146. border-radius: @button-round-border-radius;
  147. }
  148. &.van-button--square::after {
  149. border-radius: 0;
  150. }
  151. }
  152. }