_tools.scss 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. /* ==================
  2. 常用工具
  3. ==================== */
  4. .ss-bg-opactity-block {
  5. background-color: rgba(#000, 0.2);
  6. color: #fff;
  7. }
  8. /* ==================
  9. flex布局
  10. ==================== */
  11. .ss-flex {
  12. display: flex;
  13. flex-direction: row;
  14. align-items: center;
  15. }
  16. .ss-flex-1 {
  17. flex: 1;
  18. }
  19. .ss-flex-col {
  20. display: flex;
  21. flex-direction: column;
  22. }
  23. .ss-flex-wrap {
  24. flex-wrap: wrap;
  25. }
  26. .ss-flex-nowrap {
  27. flex-wrap: nowrap;
  28. }
  29. .ss-col-center {
  30. align-items: center;
  31. }
  32. .ss-col-top {
  33. align-items: flex-start;
  34. }
  35. .ss-col-bottom {
  36. align-items: flex-end;
  37. }
  38. .ss-col-stretch {
  39. align-items: stretch;
  40. }
  41. .ss-row-center {
  42. justify-content: center;
  43. }
  44. .ss-row-left {
  45. justify-content: flex-start;
  46. }
  47. .ss-row-right {
  48. justify-content: flex-end;
  49. }
  50. .ss-row-between {
  51. justify-content: space-between;
  52. }
  53. .ss-row-around {
  54. justify-content: space-around;
  55. }
  56. .ss-self-start {
  57. align-self: flex-start;
  58. }
  59. .ss-self-end {
  60. align-self: flex-end;
  61. }
  62. .ss-self-center {
  63. align-self: center;
  64. }
  65. .ss-h-100 {
  66. height: 100%;
  67. }
  68. .ss-w-100 {
  69. width: 100%;
  70. }
  71. /* ==================
  72. margin padding: 内外边距
  73. ==================== */
  74. @for $i from 0 through 100 {
  75. // 只要双数和能被5除尽的数
  76. @if $i % 2==0 or $i % 5==0 {
  77. // 得出:u-margin-30或者u-m-30
  78. .ss-margin-#{$i},
  79. .ss-m-#{$i} {
  80. margin: $i + rpx;
  81. }
  82. .ss-m-x-#{$i} {
  83. margin-left: $i + rpx;
  84. margin-right: $i + rpx;
  85. }
  86. .ss-m-y-#{$i} {
  87. margin-top: $i + rpx;
  88. margin-bottom: $i + rpx;
  89. }
  90. // 得出:u-padding-30或者u-p-30
  91. .ss-padding-#{$i},
  92. .ss-p-#{$i} {
  93. padding: $i + rpx;
  94. }
  95. .ss-p-x-#{$i} {
  96. padding-left: $i + rpx;
  97. padding-right: $i + rpx;
  98. }
  99. .ss-p-y-#{$i} {
  100. padding-top: $i + rpx;
  101. padding-bottom: $i + rpx;
  102. }
  103. @each $short, $long in l left, t top, r right, b bottom {
  104. // 缩写版,结果如: u-m-l-30
  105. // 定义外边距
  106. .ss-m-#{$short}-#{$i} {
  107. margin-#{$long}: $i + rpx;
  108. }
  109. // 定义内边距
  110. .ss-p-#{$short}-#{$i} {
  111. padding-#{$long}: $i + rpx;
  112. }
  113. // 完整版,结果如:u-margin-left-30
  114. // 定义外边距
  115. .ss-margin-#{$long}-#{$i} {
  116. margin-#{$long}: $i + rpx;
  117. }
  118. // 定义内边距
  119. .ss-padding-#{$long}-#{$i} {
  120. padding-#{$long}: $i + rpx;
  121. }
  122. }
  123. }
  124. }
  125. /* ==================
  126. radius
  127. ==================== */
  128. @for $i from 0 through 100 {
  129. // 只要双数和能被5除尽的数
  130. @if $i % 2==0 or $i % 5==0 {
  131. .ss-radius-#{$i},
  132. .ss-r-#{$i} {
  133. border-radius: $i + rpx;
  134. }
  135. .ss-r-t-#{$i} {
  136. border-top-left-radius: $i + rpx;
  137. border-top-right-radius: $i + rpx;
  138. }
  139. .ss-r-b-#{$i} {
  140. border-bottom-left-radius: $i + rpx;
  141. border-bottom-right-radius: $i + rpx;
  142. }
  143. @each $short, $long in tl 'top-left', tr 'top-right', bl 'bottom-right', br 'bottom-right' {
  144. // 定义外边距
  145. .ss-r-#{$short}-#{$i} {
  146. border-#{$long}-radius: $i + rpx;
  147. }
  148. // 定义内边距
  149. .ss-radius-#{$long}-#{$i} {
  150. border-#{$long}-radius: $i + rpx;
  151. }
  152. }
  153. }
  154. }
  155. /* ==================
  156. 溢出省略号
  157. @param {Number} 行数
  158. ==================== */
  159. @mixin ellipsis($rowCount: 1) {
  160. // @if $rowCount <=1 {
  161. // overflow: hidden;
  162. // text-overflow: ellipsis;
  163. // white-space: nowrap;
  164. // } @else {
  165. // min-width: 0;
  166. // overflow: hidden;
  167. // text-overflow: ellipsis;
  168. // display: -webkit-box;
  169. // -webkit-line-clamp: $rowCount;
  170. // -webkit-box-orient: vertical;
  171. // }
  172. min-width: 0;
  173. overflow: hidden;
  174. text-overflow: ellipsis;
  175. display: -webkit-box;
  176. -webkit-line-clamp: $rowCount;
  177. -webkit-box-orient: vertical;
  178. }
  179. @for $i from 1 through 6 {
  180. .ss-line-#{$i} {
  181. @include ellipsis($i);
  182. }
  183. }
  184. /* ==================
  185. hover
  186. ==================== */
  187. .ss-hover-class {
  188. background-color: $gray-c;
  189. opacity: 0.6;
  190. }
  191. .ss-hover-btn {
  192. transform: translate(1px, 1px);
  193. }
  194. /* ==================
  195. 底部安全区域
  196. ==================== */
  197. .ss-safe-bottom {
  198. padding-bottom: 0;
  199. padding-bottom: calc(constant(safe-area-inset-bottom) / 5 * 3);
  200. padding-bottom: calc(env(safe-area-inset-bottom) / 5 * 3);
  201. }
  202. /* ==================
  203. 字体大小
  204. ==================== */
  205. @for $i from 20 through 50 {
  206. .ss-font-#{$i} {
  207. font-size: $i + rpx;
  208. }
  209. }
  210. /* ==================
  211. 按钮
  212. ==================== */
  213. .ss-reset-button {
  214. padding: 0;
  215. margin: 0;
  216. font-size: inherit;
  217. background-color: transparent;
  218. color: inherit;
  219. position: relative;
  220. border: 0rpx;
  221. /* #ifndef APP-NVUE */
  222. display: flex;
  223. /* #endif */
  224. align-items: center;
  225. justify-content: center;
  226. box-sizing: border-box;
  227. text-align: center;
  228. text-decoration: none;
  229. white-space: nowrap;
  230. vertical-align: baseline;
  231. transform: translate(0, 0);
  232. }
  233. .ss-reset-button.button-hover {
  234. transform: translate(1px, 1px);
  235. background: none;
  236. }
  237. .ss-reset-button::after {
  238. border: none;
  239. }