common.scss 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. .u-relative,
  2. .u-rela {
  3. position: relative;
  4. }
  5. .u-absolute,
  6. .u-abso {
  7. position: absolute;
  8. }
  9. // nvue不能用标签命名样式,不能放在微信组件中,否则微信开发工具会报警告,无法使用标签名当做选择器
  10. /* #ifndef APP-NVUE */
  11. image {
  12. display: inline-block;
  13. }
  14. // 在weex,也即nvue中,所有元素默认为border-box
  15. view,
  16. text {
  17. box-sizing: border-box;
  18. }
  19. /* #endif */
  20. .u-font-xs {
  21. font-size: 22rpx;
  22. }
  23. .u-font-sm {
  24. font-size: 26rpx;
  25. }
  26. .u-font-md {
  27. font-size: 28rpx;
  28. }
  29. .u-font-lg {
  30. font-size: 30rpx;
  31. }
  32. .u-font-xl {
  33. font-size: 34rpx;
  34. }
  35. .u-flex {
  36. /* #ifndef APP-NVUE */
  37. display: flex;
  38. /* #endif */
  39. flex-direction: row;
  40. align-items: center;
  41. }
  42. .u-flex-wrap {
  43. flex-wrap: wrap;
  44. }
  45. .u-flex-nowrap {
  46. flex-wrap: nowrap;
  47. }
  48. .u-col-center {
  49. align-items: center;
  50. }
  51. .u-col-top {
  52. align-items: flex-start;
  53. }
  54. .u-col-bottom {
  55. align-items: flex-end;
  56. }
  57. .u-row-center {
  58. justify-content: center;
  59. }
  60. .u-row-left {
  61. justify-content: flex-start;
  62. }
  63. .u-row-right {
  64. justify-content: flex-end;
  65. }
  66. .u-row-between {
  67. justify-content: space-between;
  68. }
  69. .u-row-around {
  70. justify-content: space-around;
  71. }
  72. .u-text-left {
  73. text-align: left;
  74. }
  75. .u-text-center {
  76. text-align: center;
  77. }
  78. .u-text-right {
  79. text-align: right;
  80. }
  81. .u-flex-col {
  82. /* #ifndef APP-NVUE */
  83. display: flex;
  84. /* #endif */
  85. flex-direction: column;
  86. }
  87. /**
  88. * 弹性盒三段式布局
  89. */
  90. .page_box {
  91. height: 100%;
  92. width: 100%;
  93. display: flex;
  94. flex-direction: column;
  95. justify-content: space-between;
  96. overflow-x: hidden;
  97. background: $u-bg-color;
  98. }
  99. .scroll-box {
  100. flex: 1;
  101. height: 100%;
  102. position: relative;
  103. }
  104. .content_box {
  105. flex: 1;
  106. overflow-y: auto;
  107. }
  108. /**
  109. * 溢出省略号
  110. * @param {Number} 行数
  111. */
  112. @mixin ellipsis($rowCount: 1) {
  113. @if $rowCount <=1 {
  114. overflow: hidden;
  115. text-overflow: ellipsis;
  116. white-space: nowrap;
  117. } @else {
  118. min-width: 0;
  119. overflow: hidden;
  120. text-overflow: ellipsis;
  121. display: -webkit-box;
  122. -webkit-line-clamp: $rowCount;
  123. -webkit-box-orient: vertical;
  124. }
  125. }
  126. @for $i from 1 through 12 {
  127. .u-ellipsis-#{$i} {
  128. @include ellipsis($i);
  129. }
  130. }
  131. // 定义flex等分
  132. @for $i from 0 through 12 {
  133. .u-flex-#{$i} {
  134. flex: $i;
  135. }
  136. }
  137. // 定义字体(px)单位,小于20都为px单位字体
  138. @for $i from 9 to 20 {
  139. .u-font-#{$i} {
  140. font-size: $i + px;
  141. }
  142. }
  143. // 定义字体(rpx)单位,大于或等于20的都为rpx单位字体
  144. @for $i from 20 through 40 {
  145. .u-font-#{$i} {
  146. font-size: $i + rpx;
  147. }
  148. }
  149. // 定义内外边距,历遍1-100
  150. @for $i from 0 through 100 {
  151. // 只要双数和能被5除尽的数
  152. @if $i % 2 == 0 or $i % 5 == 0 {
  153. // 得出:u-margin-30或者u-m-30
  154. .u-margin-#{$i},
  155. .u-m-#{$i} {
  156. margin: $i + rpx !important;
  157. }
  158. .u-m-x-#{$i} {
  159. margin-left: $i + rpx !important;
  160. margin-right: $i + rpx !important;
  161. }
  162. .u-m-y-#{$i} {
  163. margin-top: $i + rpx !important;
  164. margin-bottom: $i + rpx !important;
  165. }
  166. // 得出:u-padding-30或者u-p-30
  167. .u-padding-#{$i},
  168. .u-p-#{$i} {
  169. padding: $i + rpx !important;
  170. }
  171. .u-p-x-#{$i} {
  172. padding-left: $i + rpx !important;
  173. padding-right: $i + rpx !important;
  174. }
  175. .u-p-y-#{$i} {
  176. padding-top: $i + rpx !important;
  177. padding-bottom: $i + rpx !important;
  178. }
  179. @each $short, $long in l left, t top, r right, b bottom {
  180. // 缩写版,结果如: u-m-l-30
  181. // 定义外边距
  182. .u-m-#{$short}-#{$i} {
  183. margin-#{$long}: $i + rpx !important;
  184. }
  185. // 定义内边距
  186. .u-p-#{$short}-#{$i} {
  187. padding-#{$long}: $i + rpx !important;
  188. }
  189. // 完整版,结果如:u-margin-left-30
  190. // 定义外边距
  191. .u-margin-#{$long}-#{$i} {
  192. margin-#{$long}: $i + rpx !important;
  193. }
  194. // 定义内边距
  195. .u-padding-#{$long}-#{$i} {
  196. padding-#{$long}: $i + rpx !important;
  197. }
  198. }
  199. }
  200. }
  201. // 重置nvue的默认关于flex的样式
  202. .u-reset-nvue {
  203. flex-direction: row;
  204. align-items: center;
  205. }