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.
 
 
 

174 lines
2.6 KiB

  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. will-change: transform;
  15. }
  16. // 在weex,也即nvue中,所有元素默认为border-box
  17. view,
  18. text {
  19. box-sizing: border-box;
  20. }
  21. /* #endif */
  22. .u-font-xs {
  23. font-size: 22rpx;
  24. }
  25. .u-font-sm {
  26. font-size: 26rpx;
  27. }
  28. .u-font-md {
  29. font-size: 28rpx;
  30. }
  31. .u-font-lg {
  32. font-size: 30rpx;
  33. }
  34. .u-font-xl {
  35. font-size: 34rpx;
  36. }
  37. .u-flex {
  38. /* #ifndef APP-NVUE */
  39. display: flex;
  40. /* #endif */
  41. flex-direction: row;
  42. align-items: center;
  43. }
  44. .u-flex-wrap {
  45. flex-wrap: wrap;
  46. }
  47. .u-flex-nowrap {
  48. flex-wrap: nowrap;
  49. }
  50. .u-col-center {
  51. align-items: center;
  52. }
  53. .u-col-top {
  54. align-items: flex-start;
  55. }
  56. .u-col-bottom {
  57. align-items: flex-end;
  58. }
  59. .u-row-center {
  60. justify-content: center;
  61. }
  62. .u-row-left {
  63. justify-content: flex-start;
  64. }
  65. .u-row-right {
  66. justify-content: flex-end;
  67. }
  68. .u-row-between {
  69. justify-content: space-between;
  70. }
  71. .u-row-around {
  72. justify-content: space-around;
  73. }
  74. .u-text-left {
  75. text-align: left;
  76. }
  77. .u-text-center {
  78. text-align: center;
  79. }
  80. .u-text-right {
  81. text-align: right;
  82. }
  83. .u-flex-col {
  84. /* #ifndef APP-NVUE */
  85. display: flex;
  86. /* #endif */
  87. flex-direction: column;
  88. }
  89. // 定义flex等分
  90. @for $i from 0 through 12 {
  91. .u-flex-#{$i} {
  92. flex: $i;
  93. }
  94. }
  95. // 定义字体(px)单位,小于20都为px单位字体
  96. @for $i from 9 to 20 {
  97. .u-font-#{$i} {
  98. font-size: $i + px;
  99. }
  100. }
  101. // 定义字体(rpx)单位,大于或等于20的都为rpx单位字体
  102. @for $i from 20 through 40 {
  103. .u-font-#{$i} {
  104. font-size: $i + rpx;
  105. }
  106. }
  107. // 定义内外边距,历遍1-80
  108. @for $i from 0 through 80 {
  109. // 只要双数和能被5除尽的数
  110. @if $i % 2 == 0 or $i % 5 == 0 {
  111. // 得出:u-margin-30或者u-m-30
  112. .u-margin-#{$i}, .u-m-#{$i} {
  113. margin: $i + rpx!important;
  114. }
  115. // 得出:u-padding-30或者u-p-30
  116. .u-padding-#{$i}, .u-p-#{$i} {
  117. padding: $i + rpx!important;
  118. }
  119. @each $short, $long in l left, t top, r right, b bottom {
  120. // 缩写版,结果如: u-m-l-30
  121. // 定义外边距
  122. .u-m-#{$short}-#{$i} {
  123. margin-#{$long}: $i + rpx!important;
  124. }
  125. // 定义内边距
  126. .u-p-#{$short}-#{$i} {
  127. padding-#{$long}: $i + rpx!important;
  128. }
  129. // 完整版,结果如:u-margin-left-30
  130. // 定义外边距
  131. .u-margin-#{$long}-#{$i} {
  132. margin-#{$long}: $i + rpx!important;
  133. }
  134. // 定义内边距
  135. .u-padding-#{$long}-#{$i} {
  136. padding-#{$long}: $i + rpx!important;
  137. }
  138. }
  139. }
  140. }