云链智安app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index-u.scss 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. @import '@/uni_modules/lime-style/index.scss';
  2. @import '@/uni_modules/lime-style/functions.scss';
  3. $prefix: l !default;
  4. $switch: #{$prefix}-switch;
  5. $switch-checked-color: create-var(switch-checked-color, $primary-color);
  6. $switch-checked-disabled-color: create-var(switch-checked-disabled-color, $primary-color-3);
  7. $switch-unchecked-color: create-var(switch-unchecked-color, $gray-4);
  8. $switch-unchecked-disabled-color: create-var(switch-unchecked-disabled-color, $gray-2);
  9. $switch-width: create-var(switch-width, 90rpx);
  10. $switch-height: create-var(switch-height, 56rpx);
  11. $switch-square-radius: create-var(switch-radius, 8rpx);
  12. $switch-round-radius: create-var(switch-radius, 99px);
  13. $switch-dot-bg-color: create-var(switch-dot-bg-color, white);
  14. $switch-dot-size: create-var(switch-dot-size, 44rpx);
  15. // $switch-dot-size-pressed: create-var(switch-dot-size-pressed, 56rpx);
  16. // $switch-dot-size-pressed: create-var(switch-dot-size-pressed, calc($switch-dot-size * 1.25));
  17. $switch-dot-shadow: create-var(switch-dot-shadow, $shadow-1);
  18. $switch-dot-round-radius: create-var(switch-dot-radius, 99px);
  19. $switch-dot-square-radius: create-var(switch-dot-radius, 5rpx);
  20. $swtich-font-size: create-var(swtich-font-size, 28rpx);
  21. $swtich-text-color: create-var(swtich-text-color, white);
  22. /* #ifdef APP-ANDROID || APP-IOS */
  23. $switch-dot-size-pressed: create-var(switch-dot-size-pressed, 56rpx);
  24. $switch-dot-offset: create-var(switch-dot-offset, divide($switch-height - $switch-dot-size, 2));
  25. $placeholder-offset: 1.20 * $switch-height - $switch-dot-offset;
  26. // #endif
  27. /* #ifndef APP-ANDROID || APP-IOS */
  28. $switch-dot-size-pressed: create-var(switch-dot-size-pressed, calc(#{$switch-dot-size} * 1.25));
  29. $switch-dot-offset: create-var(switch-dot-offset, calc((#{$switch-height} - #{$switch-dot-size}) / 2));
  30. $placeholder-offset: calc(1.20 * #{$switch-height} - #{$switch-dot-offset});
  31. // #endif
  32. .#{$switch} {
  33. // font-size: $swtich-font-size;
  34. /* #ifndef APP-ANDROID || APP-IOS */
  35. display: inline-flex;
  36. /* #endif */
  37. flex-direction: row;
  38. align-items: center;
  39. &__rail {
  40. /* #ifndef APP-ANDROID || APP-IOS */
  41. position: relative;
  42. /* #endif */
  43. height: $switch-height;
  44. min-width: $switch-width;
  45. transition-duration: 300ms;
  46. transition-property: background-color;
  47. transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  48. }
  49. &--hover {
  50. .#{$switch}__dot {
  51. max-width: $switch-dot-size-pressed;
  52. }
  53. }
  54. &--hover#{&}--checked{
  55. /* #ifndef APP-ANDROID || APP-IOS */
  56. .#{$switch}__dot {
  57. left: calc(100% - #{$switch-dot-size-pressed} - #{$switch-dot-offset});
  58. }
  59. .#{$switch}__placeholder--unchecked {
  60. padding-left: calc(1.25 * #{$switch-dot-size-pressed});
  61. }
  62. // #endif
  63. }
  64. &--hover#{&}--unchecked{
  65. /* #ifndef APP-ANDROID || APP-IOS */
  66. .#{$switch}__placeholder--checked {
  67. padding-right: calc(1.25 * #{$switch-dot-size-pressed});
  68. }
  69. // #endif
  70. }
  71. &--checked {
  72. background-color: $switch-checked-color;
  73. /* #ifndef APP-ANDROID || APP-IOS */
  74. .#{$switch}__dot {
  75. left: calc(100% - #{$switch-dot-size} - #{$switch-dot-offset});
  76. }
  77. // #endif
  78. }
  79. &--checked#{&}--disabled {
  80. background-color: $switch-checked-disabled-color;
  81. }
  82. &--unchecked {
  83. background-color: $switch-unchecked-color;
  84. }
  85. &--unchecked#{&}--disabled {
  86. background-color: $switch-unchecked-disabled-color;
  87. }
  88. &--round {
  89. border-radius: $switch-round-radius;
  90. }
  91. &--square {
  92. border-radius: $switch-square-radius;
  93. }
  94. &__dot {
  95. position: absolute;
  96. background-color: $switch-dot-bg-color;
  97. height: $switch-dot-size;
  98. pointer-events: none;
  99. justify-content: center;
  100. align-items: center;
  101. overflow: visible;
  102. transition-duration: 300ms;
  103. transition-property: background-color, opacity, left, max-width, width, box-shadow, transform;
  104. transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  105. // transition: all cubic-bezier(0.4, 0, 0.2, 1);
  106. // transition: background-color .3s var(--n-bezier), left .3s var(--n-bezier), opacity .3s var(--n-bezier), max-width .3s var(--n-bezier), box-shadow .3s var(--n-bezier);
  107. /* #ifndef APP-ANDROID || APP-IOS */
  108. display: flex;
  109. width: $switch-dot-size-pressed;//$switch-dot-size;
  110. max-width: $switch-dot-size;
  111. left: $switch-dot-offset;
  112. top: $switch-dot-offset;
  113. --l-loading-size: calc(#{$switch-dot-size} * 0.7);
  114. --l-loading-color: #{$switch-checked-color};
  115. /* #endif */
  116. /* #ifdef APP-ANDROID || APP-IOS */
  117. width: $switch-dot-size;
  118. /* #endif */
  119. &--round {
  120. border-radius: $switch-dot-round-radius;
  121. }
  122. &--square {
  123. border-radius: $switch-dot-square-radius;
  124. }
  125. }
  126. &__placeholder {
  127. overflow: visible;
  128. position: absolute;
  129. white-space: nowrap;
  130. pointer-events: none;
  131. // top: 0;
  132. // bottom: 0;
  133. top: 50%;
  134. /* #ifdef APP-ANDROID || APP-IOS */
  135. transform: translateY(-50%);
  136. /* #endif */
  137. /* #ifndef APP-ANDROID || APP-IOS */
  138. transform: translateY(-53%);
  139. line-height: 1;
  140. /* #endif */
  141. font-size: $swtich-font-size;
  142. color: $swtich-text-color;
  143. // background-color: aqua;
  144. // line-height: $switch-dot-size;
  145. // height: $switch-dot-size;
  146. box-sizing: content-box;
  147. &--checked {
  148. right: 0;
  149. text-align: right;
  150. padding-right: $placeholder-offset;
  151. }
  152. &--unchecked {
  153. left: 0;
  154. padding-left: $placeholder-offset;
  155. }
  156. }
  157. /* #ifndef APP-ANDROID || APP-IOS */
  158. &__children-placeholder {
  159. height: $switch-height;
  160. }
  161. &__rail {
  162. &-placeholder {
  163. opacity: 0;
  164. padding-left: calc(1.75 * #{$switch-height});
  165. font-size: $swtich-font-size;
  166. }
  167. }
  168. /* #endif */
  169. }