common.scss 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. @mixin icon-image($size) {
  2. min-height: $size;
  3. min-width: $size;
  4. height: $size;
  5. width: $size;
  6. vertical-align: middle;
  7. }
  8. page {
  9. /* 定义一些主题色及基础样式 */
  10. font-family: PingFang SC, Arial, Hiragino Sans GB, Microsoft YaHei, sans-serif;
  11. font-size: 28rpx;
  12. color: $-color-normal;
  13. padding-bottom: env(safe-area-inset-bottom);
  14. background-color: $-color-body;
  15. }
  16. .bold {
  17. font-weight: bold;
  18. }
  19. /* 定义字体颜色 */
  20. .primary {
  21. color: $-color-primary;
  22. }
  23. .black {
  24. color: $-color-black;
  25. }
  26. .white {
  27. color: $-color-white;
  28. }
  29. .normal {
  30. color: $-color-normal;
  31. }
  32. .lighter {
  33. color: $-color-lighter;
  34. }
  35. .muted {
  36. color: $-color-muted;
  37. }
  38. /* 定义背景颜色 */
  39. .bg-primary {
  40. background-color: $-color-primary;
  41. }
  42. .bg-body {
  43. background-color: $-color-body;
  44. }
  45. .bg-gray {
  46. background-color: $-color-border;
  47. }
  48. /* 定义字体大小 */
  49. .xxl {
  50. font-size: 36rpx;
  51. }
  52. .xl {
  53. font-size: 34rpx;
  54. }
  55. .lg {
  56. font-size: 32rpx;
  57. }
  58. .md {
  59. font-size: 30rpx;
  60. }
  61. .nr {
  62. font-size: 28rpx;
  63. }
  64. .sm {
  65. font-size: 26rpx;
  66. }
  67. .xs {
  68. font-size: 24rpx;
  69. }
  70. .xxs {
  71. font-size: 22rpx;
  72. }
  73. // 定义内外边距,历遍1-80
  74. @for $i from 0 through 60 {
  75. // 只要双数和能被5除尽的数
  76. @if $i % 2 == 0 or $i % 5 == 0 {
  77. // 如:m-30
  78. .m-#{$i} {
  79. margin: $i + rpx;
  80. }
  81. // 如:p-30
  82. .p-#{$i} {
  83. padding: $i + rpx;
  84. }
  85. @each $short, $long in l left, t top, r right, b bottom {
  86. //结果如: m-l-30
  87. // 定义外边距
  88. .m-#{$short}-#{$i} {
  89. margin-#{$long}: $i + rpx;
  90. }
  91. // 定义内边距
  92. //结果如: p-l-30
  93. .p-#{$short}-#{$i} {
  94. padding-#{$long}: $i + rpx;
  95. }
  96. }
  97. }
  98. }
  99. .inline {
  100. display: inline-block;
  101. }
  102. /* 定义常用的弹性布局 */
  103. .flex {
  104. /* #ifndef APP-NVUE */
  105. display: flex;
  106. /* #endif */
  107. flex-direction: row;
  108. align-items: center;
  109. }
  110. .flex-wrap {
  111. flex-wrap: wrap;
  112. }
  113. .flex-nowrap {
  114. flex-wrap: nowrap;
  115. }
  116. .col-baseline {
  117. align-items: baseline;
  118. }
  119. .col-center {
  120. align-items: center;
  121. }
  122. .col-top {
  123. align-items: flex-start;
  124. }
  125. .col-bottom {
  126. align-items: flex-end;
  127. }
  128. .col-stretch {
  129. align-items: stretch;
  130. }
  131. .row-center {
  132. justify-content: center;
  133. }
  134. .row-left {
  135. justify-content: flex-start;
  136. }
  137. .row-right {
  138. justify-content: flex-end;
  139. }
  140. .row-between {
  141. justify-content: space-between;
  142. }
  143. .row-around {
  144. justify-content: space-around;
  145. }
  146. .text-left {
  147. text-align: left;
  148. }
  149. .text-center {
  150. text-align: center;
  151. }
  152. .text-right {
  153. text-align: right;
  154. }
  155. .flex-col {
  156. /* #ifndef APP-NVUE */
  157. display: flex;
  158. /* #endif */
  159. flex-direction: column;
  160. }
  161. // 定义flex等分
  162. @for $i from 0 through 5 {
  163. .flex-#{$i} {
  164. flex: $i;
  165. }
  166. }
  167. .flex-none {
  168. flex: none;
  169. }
  170. // 定义字体大小,38-60的字体
  171. @for $i from 38 through 60 {
  172. @if $i % 2 == 0 {
  173. .font-size-#{$i} {
  174. font-size: $i + rpx;
  175. }
  176. }
  177. }
  178. /* 超出隐藏 */
  179. /* start--文本行数限制--start */
  180. .line-1 {
  181. overflow: hidden;
  182. white-space: nowrap;
  183. text-overflow: ellipsis;
  184. }
  185. .line-2 {
  186. -webkit-line-clamp: 2;
  187. }
  188. .line-3 {
  189. -webkit-line-clamp: 3;
  190. }
  191. .line-2,
  192. .line-3 {
  193. overflow: hidden;
  194. word-break: break-all;
  195. text-overflow: ellipsis;
  196. display: -webkit-box; // 弹性伸缩盒
  197. -webkit-box-orient: vertical; // 设置伸缩盒子元素排列方式
  198. }
  199. /* 中划线 */
  200. .line-through {
  201. text-decoration: line-through;
  202. }
  203. /* br60 */
  204. .br60 {
  205. border-radius: 60rpx;
  206. }
  207. /* 初始化按钮 */
  208. page button {
  209. padding: 0;
  210. margin: 0;
  211. background-color: transparent;
  212. font-weight: normal;
  213. font-size: 28rpx;
  214. overflow: unset;
  215. margin-left: 0;
  216. margin-right: 0;
  217. }
  218. page button::after {
  219. border: none;
  220. }
  221. button[type='primary'] {
  222. background-color: $-color-primary;
  223. }
  224. button[disabled][type='primary'] {
  225. background-color: $-color-primary;
  226. opacity: 0.4;
  227. }
  228. .button-hover[type='primary'] {
  229. background-color: $-color-primary;
  230. }
  231. /* 按钮大小 */
  232. button[size='xs'] {
  233. line-height: 58rpx;
  234. height: 58rpx;
  235. font-size: 26rpx;
  236. padding: 0 30rpx;
  237. }
  238. button[size='sm'] {
  239. line-height: 62rpx;
  240. height: 62rpx;
  241. font-size: 28rpx;
  242. padding: 0 30rpx;
  243. }
  244. button[size='md'] {
  245. line-height: 70rpx;
  246. height: 70rpx;
  247. font-size: 30rpx;
  248. padding: 0 30rpx;
  249. }
  250. button[size='lg'] {
  251. line-height: 80rpx;
  252. height: 80rpx;
  253. font-size: 32rpx;
  254. padding: 0 30rpx;
  255. }
  256. //******图标******/
  257. .icon-xs {
  258. @include icon-image(28rpx);
  259. }
  260. .icon-sm {
  261. @include icon-image(30rpx);
  262. }
  263. .icon {
  264. @include icon-image(34rpx);
  265. }
  266. .icon-md {
  267. @include icon-image(44rpx);
  268. }
  269. .icon-lg {
  270. @include icon-image(52rpx);
  271. }
  272. .icon-xl {
  273. @include icon-image(64rpx);
  274. }
  275. .icon-xxl {
  276. @include icon-image(120rpx);
  277. }
  278. .img-null {
  279. width: 300rpx;
  280. height: 300rpx;
  281. }
  282. /* 隐藏滚动条 */
  283. ::-webkit-scrollbar {
  284. width: 0;
  285. height: 0;
  286. color: transparent;
  287. }