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.

299 lines
4.8 KiB

5 months ago
  1. // .u-flex {
  2. // @include vue-flex(row);
  3. // }
  4. // .u-flex-x {
  5. // @include vue-flex(row);
  6. // }
  7. // .u-flex-y {
  8. // @include vue-flex(column);
  9. // }
  10. // .u-flex-xy-center {
  11. // @include vue-flex(row);
  12. // justify-content: center;
  13. // align-items: center;
  14. // }
  15. // .u-flex-x-center {
  16. // @include vue-flex(row);
  17. // justify-content: center;
  18. // }
  19. // .u-flex-y-center {
  20. // @include vue-flex(column);
  21. // justify-content: center;
  22. // }
  23. // flex布局
  24. .u-flex,
  25. .u-flex-row,
  26. .u-flex-x {
  27. @include flex;
  28. }
  29. .u-flex-y,
  30. .u-flex-column {
  31. @include flex(column);
  32. }
  33. .u-flex-x-center {
  34. @include flex;
  35. justify-content: center;
  36. }
  37. .u-flex-xy-center {
  38. @include flex;
  39. justify-content: center;
  40. align-items: center;
  41. }
  42. .u-flex-y-center {
  43. @include flex;
  44. align-items: center;
  45. }
  46. .u-flex-x-left {
  47. @include flex;
  48. }
  49. .u-flex-x-reverse,
  50. .u-flex-row-reverse {
  51. flex-direction: row-reverse;
  52. }
  53. .u-flex-y-reverse,
  54. .u-flex-column-reverse {
  55. flex-direction: column-reverse;
  56. }
  57. /* #ifndef APP-NVUE */
  58. // 此处为vue版本的简写,因为nvue不支持同时作用于两个类名的样式写法
  59. // nvue下只能写成class="u-flex-x u-flex-x-reverse的形式"
  60. .u-flex.u-flex-reverse,
  61. .u-flex-row.u-flex-reverse,
  62. .u-flex-x.u-flex-reverse {
  63. flex-direction: row-reverse;
  64. }
  65. .u-flex-column.u-flex-reverse,
  66. .u-flex-y.u-flex-reverse {
  67. flex-direction: column-reverse;
  68. }
  69. // 自动伸缩
  70. .u-flex-fill {
  71. flex: 1 1 auto;
  72. }
  73. // 边界自动伸缩
  74. .u-margin-top-auto,
  75. .u-m-t-auto {
  76. margin-top: auto !important;
  77. }
  78. .u-margin-right-auto,
  79. .u-m-r-auto {
  80. margin-right: auto !important;
  81. }
  82. .u-margin-bottom-auto,
  83. .u-m-b-auto {
  84. margin-bottom: auto !important;
  85. }
  86. .u-margin-left-auto,
  87. .u-m-l-auto {
  88. margin-left: auto !important;
  89. }
  90. .u-margin-center-auto,
  91. .u-m-c-auto {
  92. margin-left: auto !important;
  93. margin-right: auto !important;
  94. }
  95. .u-margin-middle-auto,
  96. .u-m-m-auto {
  97. margin-top: auto !important;
  98. margin-bottom: auto !important;
  99. }
  100. /* #endif */
  101. // 换行
  102. .u-flex-wrap {
  103. flex-wrap: wrap;
  104. }
  105. // 反向换行
  106. .u-flex-wrap-reverse {
  107. flex-wrap: wrap-reverse;
  108. }
  109. // 主轴起点对齐
  110. .u-flex-start {
  111. justify-content: flex-start;
  112. }
  113. // 主轴中间对齐
  114. .u-flex-center {
  115. justify-content: center;
  116. }
  117. // 主轴终点对齐
  118. .u-flex-end {
  119. justify-content: flex-end;
  120. }
  121. // 主轴等比间距
  122. .u-flex-between {
  123. justify-content: space-between;
  124. }
  125. // 主轴均分间距
  126. .u-flex-around {
  127. justify-content: space-around;
  128. }
  129. // 交叉轴起点对齐
  130. .u-flex-items-start {
  131. align-items: flex-start;
  132. }
  133. // 交叉轴中间对齐
  134. .u-flex-items-center {
  135. align-items: center;
  136. }
  137. // 交叉轴终点对齐
  138. .u-flex-items-end {
  139. align-items: flex-end;
  140. }
  141. // 交叉轴第一行文字基线对齐
  142. .u-flex-items-baseline {
  143. /* #ifndef APP-NVUE */
  144. align-items: baseline;
  145. /* #endif */
  146. }
  147. // 交叉轴方向拉伸对齐
  148. .u-flex-items-stretch {
  149. align-items: stretch;
  150. }
  151. // 以下属于项目(子元素)的类
  152. // 子元素交叉轴起点对齐
  153. /* #ifndef APP-NVUE */
  154. .u-flex-self-start {
  155. align-self: flex-start;
  156. }
  157. // 子元素交叉轴居中对齐
  158. .u-flex-self-center {
  159. align-self: center;
  160. }
  161. // 子元素交叉轴终点对齐
  162. .u-flex-self-end {
  163. align-self: flex-end;
  164. }
  165. // 子元素交叉轴第一行文字基线对齐
  166. .u-flex-self-baseline {
  167. align-self: baseline;
  168. }
  169. // 子元素交叉轴方向拉伸对齐
  170. .u-flex-self-stretch {
  171. align-self: stretch;
  172. }
  173. /* #endif */
  174. // 多轴交叉时的对齐方式
  175. // 起点对齐
  176. .u-flex-content-start {
  177. align-content: flex-start;
  178. }
  179. // 居中对齐
  180. .u-flex-content-center {
  181. align-content: center;
  182. }
  183. // 终点对齐
  184. .u-flex-content-end {
  185. align-content: flex-end;
  186. }
  187. // 两端对齐
  188. .u-flex-content-between {
  189. align-content: space-between;
  190. }
  191. // 均分间距
  192. .u-flex-content-around {
  193. align-content: space-around;
  194. }
  195. // 全部居中对齐
  196. .u-flex-middle {
  197. justify-content: center;
  198. align-items: center;
  199. align-self: center;
  200. align-content: center;
  201. }
  202. // 是否可以放大
  203. .u-flex-grow {
  204. flex-grow: 1;
  205. }
  206. // 是否可以缩小
  207. .u-flex-shrink {
  208. flex-shrink: 1;
  209. }
  210. // 定义内外边距,历遍1-80
  211. @for $i from 0 through 80 {
  212. // 只要双数和能被5除尽的数
  213. @if $i % 2 == 0 or $i % 5 == 0 {
  214. // 得出:u-margin-30或者u-m-30
  215. .u-margin-#{$i}, .u-m-#{$i} {
  216. margin: $i + rpx!important;
  217. }
  218. // 得出:u-padding-30或者u-p-30
  219. .u-padding-#{$i}, .u-p-#{$i} {
  220. padding: $i + rpx!important;
  221. }
  222. @each $short, $long in l left, t top, r right, b bottom {
  223. // 缩写版,结果如: u-m-l-30
  224. // 定义外边距
  225. .u-m-#{$short}-#{$i} {
  226. margin-#{$long}: $i + rpx!important;
  227. }
  228. // 定义内边距
  229. .u-p-#{$short}-#{$i} {
  230. padding-#{$long}: $i + rpx!important;
  231. }
  232. // 完整版,结果如:u-margin-left-30
  233. // 定义外边距
  234. .u-margin-#{$long}-#{$i} {
  235. margin-#{$long}: $i + rpx!important;
  236. }
  237. // 定义内边距
  238. .u-padding-#{$long}-#{$i} {
  239. padding-#{$long}: $i + rpx!important;
  240. }
  241. }
  242. }
  243. }