523bc876752a85a482d5c7742740ab899ede68353154a99df1b1f7fb2793c1917696d8fbd51e57d9546694d2db8cc8e482ac5e3c9646cbc6e5c9bf53b2bc0a 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. @import "mixins/mixins";
  2. @import "mixins/utils";
  3. @import 'mixins/button';
  4. @import "common/var";
  5. @include b(radio) {
  6. color: $--radio-font-color;
  7. font-weight: $--radio-font-weight;
  8. line-height: 1;
  9. position: relative;
  10. cursor: pointer;
  11. display: inline-block;
  12. white-space: nowrap;
  13. outline: none;
  14. font-size: $--font-size-base;
  15. margin-right: 30px;
  16. @include utils-user-select(none);
  17. @include when(bordered) {
  18. padding: $--radio-bordered-padding;
  19. border-radius: $--border-radius-base;
  20. border: $--border-base;
  21. box-sizing: border-box;
  22. height: $--radio-bordered-height;
  23. &.is-checked {
  24. border-color: $--color-primary;
  25. }
  26. &.is-disabled {
  27. cursor: not-allowed;
  28. border-color: $--border-color-lighter;
  29. }
  30. & + .el-radio.is-bordered {
  31. margin-left: 10px;
  32. }
  33. }
  34. @include m(medium) {
  35. &.is-bordered {
  36. padding: $--radio-bordered-medium-padding;
  37. border-radius: $--button-medium-border-radius;
  38. height: $--radio-bordered-medium-height;
  39. .el-radio__label {
  40. font-size: $--button-medium-font-size;
  41. }
  42. .el-radio__inner {
  43. height: $--radio-bordered-medium-input-height;
  44. width: $--radio-bordered-medium-input-width;
  45. }
  46. }
  47. }
  48. @include m(small) {
  49. &.is-bordered {
  50. padding: $--radio-bordered-small-padding;
  51. border-radius: $--button-small-border-radius;
  52. height: $--radio-bordered-small-height;
  53. .el-radio__label {
  54. font-size: $--button-small-font-size;
  55. }
  56. .el-radio__inner {
  57. height: $--radio-bordered-small-input-height;
  58. width: $--radio-bordered-small-input-width;
  59. }
  60. }
  61. }
  62. @include m(mini) {
  63. &.is-bordered {
  64. padding: $--radio-bordered-mini-padding;
  65. border-radius: $--button-mini-border-radius;
  66. height: $--radio-bordered-mini-height;
  67. .el-radio__label {
  68. font-size: $--button-mini-font-size;
  69. }
  70. .el-radio__inner {
  71. height: $--radio-bordered-mini-input-height;
  72. width: $--radio-bordered-mini-input-width;
  73. }
  74. }
  75. }
  76. &:last-child {
  77. margin-right: 0;
  78. }
  79. @include e(input) {
  80. white-space: nowrap;
  81. cursor: pointer;
  82. outline: none;
  83. display: inline-block;
  84. line-height: 1;
  85. position: relative;
  86. vertical-align: middle;
  87. @include when(disabled) {
  88. .el-radio__inner {
  89. background-color: $--radio-disabled-input-fill;
  90. border-color: $--radio-disabled-input-border-color;
  91. cursor: not-allowed;
  92. &::after {
  93. cursor: not-allowed;
  94. background-color: $--radio-disabled-icon-color;
  95. }
  96. & + .el-radio__label {
  97. cursor: not-allowed;
  98. }
  99. }
  100. &.is-checked {
  101. .el-radio__inner {
  102. background-color: $--radio-disabled-checked-input-fill;
  103. border-color: $--radio-disabled-checked-input-border-color;
  104. &::after {
  105. background-color: $--radio-disabled-checked-icon-color;
  106. }
  107. }
  108. }
  109. & + span.el-radio__label {
  110. color: $--color-text-placeholder;
  111. cursor: not-allowed;
  112. }
  113. }
  114. @include when(checked) {
  115. .el-radio__inner {
  116. border-color: $--radio-checked-input-border-color;
  117. background: $--radio-checked-icon-color;
  118. &::after {
  119. transform: translate(-50%, -50%) scale(1);
  120. }
  121. }
  122. & + .el-radio__label {
  123. color: $--radio-checked-font-color;
  124. }
  125. }
  126. @include when(focus) {
  127. .el-radio__inner {
  128. border-color: $--radio-input-border-color-hover;
  129. }
  130. }
  131. }
  132. @include e(inner) {
  133. border: $--radio-input-border;
  134. border-radius: $--radio-input-border-radius;
  135. width: $--radio-input-width;
  136. height: $--radio-input-height;
  137. background-color: $--radio-input-background-color;
  138. position: relative;
  139. cursor: pointer;
  140. display: inline-block;
  141. box-sizing: border-box;
  142. &:hover {
  143. border-color: $--radio-input-border-color-hover;
  144. }
  145. &::after {
  146. width: 4px;
  147. height: 4px;
  148. border-radius: $--radio-input-border-radius;
  149. background-color: $--color-white;
  150. content: "";
  151. position: absolute;
  152. left: 50%;
  153. top: 50%;
  154. transform: translate(-50%, -50%) scale(0);
  155. transition: transform .15s ease-in;
  156. }
  157. }
  158. @include e(original) {
  159. opacity: 0;
  160. outline: none;
  161. position: absolute;
  162. z-index: -1;
  163. top: 0;
  164. left: 0;
  165. right: 0;
  166. bottom: 0;
  167. margin: 0;
  168. }
  169. &:focus:not(.is-focus):not(:active):not(.is-disabled) { /*获得焦点时 样式提醒*/
  170. .el-radio__inner {
  171. box-shadow: 0 0 2px 2px $--radio-input-border-color-hover;
  172. }
  173. }
  174. @include e(label) {
  175. font-size: $--radio-font-size;
  176. padding-left: 10px;
  177. }
  178. }