checkbox.scss 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. .m-checkbox{
  2. color: #606266;
  3. font-weight: 500;
  4. font-size: 14px;
  5. position: relative;
  6. cursor: pointer;
  7. display: inline-block;
  8. white-space: nowrap;
  9. user-select: none;
  10. margin-right: 30px;
  11. .m-checkbox__input{
  12. white-space: nowrap;
  13. cursor: pointer;
  14. outline: none;
  15. display: inline-block;
  16. line-height: 1;
  17. position: relative;
  18. vertical-align: middle;
  19. .m-checkbox__inner{
  20. display: inline-block;
  21. position: relative;
  22. border: 1px solid #dcdfe6;
  23. border-radius: 2px;
  24. box-sizing: border-box;
  25. width: 14px;
  26. height: 14px;
  27. background-color: #fff;
  28. z-index: 1;
  29. transition: border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46);
  30. &::after{
  31. box-sizing: content-box;
  32. content: "";
  33. border: 1px solid #fff;
  34. border-left: 0;
  35. border-top: 0;
  36. height: 7px;
  37. left: 4px;
  38. position: absolute;
  39. top: 1px;
  40. transform: rotate(45deg) scaleY(0);
  41. width: 3px;
  42. transition: transform .15s ease-in .05s;
  43. transform-origin: center;
  44. }
  45. }
  46. .m-checkbox__original{
  47. opacity: 0;
  48. outline: none;
  49. position: absolute;
  50. margin: 0;
  51. width: 0;
  52. height: 0;
  53. z-index: -1;
  54. }
  55. }
  56. //选中
  57. .is-checked{
  58. .m-checkbox__inner{
  59. background-color: #409eff;
  60. border-color: #409eff;
  61. &::after{
  62. transform: rotate(45deg) scaleY(1);
  63. }
  64. }
  65. }
  66. .is-checked.is-disabled{
  67. .m-checkbox__inner{
  68. background-color: #f2f6fc;
  69. border-color: #dcdfe6;
  70. cursor: no-drop;
  71. &::after{
  72. border-color: #c0c4cc;
  73. }
  74. }
  75. }
  76. .is-indeterminate{
  77. .m-checkbox__inner{
  78. background-color: #409eff;
  79. border-color: #409eff;
  80. &::before{
  81. content: "";
  82. position: absolute;
  83. display: block;
  84. background-color: #fff;
  85. height: 2px;
  86. transform: scale(.5);
  87. left: 0;
  88. right: 0;
  89. top: 5px;
  90. }
  91. }
  92. }
  93. .is-disabled{
  94. cursor: no-drop;
  95. color: #c0c4cc;
  96. .m-checkbox__inner{
  97. background-color: #edf2fc;
  98. border-color: #dcdfe6;
  99. cursor: not-allowed;
  100. }
  101. }
  102. .m-checkbox__label{
  103. display: inline-block;
  104. padding-left: 10px;
  105. line-height: 19px;
  106. font-size: 14px;
  107. }
  108. }
  109. // 禁用
  110. .is-disabled{
  111. cursor: no-drop;
  112. color: #c0c4cc;
  113. .m-checkbox__inner{
  114. background-color: #edf2fc;
  115. border-color: #dcdfe6;
  116. cursor: not-allowed;
  117. }
  118. }
  119. .is-disabled.is-indeterminate {
  120. .m-checkbox__inner {
  121. &::before{
  122. background-color: #c0c4cc;
  123. border-color: #c0c4cc;
  124. }
  125. }
  126. }
  127. // 边框
  128. .is-bordered{
  129. padding: 9px 20px 9px 10px;
  130. border-radius: 4px;
  131. border: 1px solid #dcdfe6;
  132. box-sizing: border-box;
  133. line-height: normal;
  134. height: 40px;
  135. }
  136. .is-bordered.is-checked{
  137. border-color: #409eff;
  138. color: #409eff;
  139. }