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.

192 lines
4.6 KiB

6 months ago
  1. /**
  2. * 这里是uni-app内置的常用样式变量
  3. *
  4. * uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
  5. * 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
  6. *
  7. */
  8. /**
  9. * 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
  10. *
  11. * 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量同时无需 import 这个文件
  12. */
  13. /* 颜色变量 */
  14. /* 页面左右间距 */
  15. $page-row-spacing: 30upx;
  16. $page-color-base: #f8f8f8;
  17. $page-color-light: #f8f6fc;
  18. $base-color: #fa436a;
  19. /* 行为相关颜色 */
  20. $uni-color-primary: #fa436a;
  21. $uni-color-success: #4cd964;
  22. $uni-color-warning: #f0ad4e;
  23. $uni-color-error: #dd524d;
  24. /* 文字基本颜色 */
  25. $uni-text-color:#333;//基本色
  26. $uni-text-color-inverse:#fff;//反色
  27. $uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息
  28. $uni-text-color-placeholder: #808080;
  29. $uni-text-color-disable:#c0c0c0;
  30. /* 背景颜色 */
  31. $uni-bg-color:#ffffff;
  32. $uni-bg-color-grey:#f8f8f8;
  33. $uni-bg-color-hover:#f1f1f1;//点击状态颜色
  34. $uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
  35. /* 边框颜色 */
  36. $uni-border-color:#c8c7cc;
  37. $border-color-dark: #DCDFE6;
  38. /* 尺寸变量 */
  39. /* 文字尺寸 */
  40. $font-base: 28upx;
  41. $font-sm: 24upx;
  42. $uni-font-size-sm:24upx;
  43. $uni-font-size-base:28upx;
  44. $uni-font-size-lg:32upx;
  45. $font-lg: 32upx;
  46. /*文字颜色*/
  47. $font-color-dark: #303133;
  48. $font-color-base: #606266;
  49. $font-color-light: #909399;
  50. $font-color-disabled: #C0C4CC;
  51. $font-color-spec: #4399fc;
  52. /* 图片尺寸 */
  53. $uni-img-size-sm:40upx;
  54. $uni-img-size-base:52upx;
  55. $uni-img-size-lg:80upx;
  56. /* Border Radius */
  57. $uni-border-radius-sm: 4upx;
  58. $uni-border-radius-base: 6upx;
  59. $uni-border-radius-lg: 12upx;
  60. $uni-border-radius-circle: 50%;
  61. /* 水平间距 */
  62. $uni-spacing-row-sm: 10px;
  63. $uni-spacing-row-base: 20upx;
  64. $uni-spacing-row-lg: 30upx;
  65. /* 垂直间距 */
  66. $uni-spacing-col-sm: 8upx;
  67. $uni-spacing-col-base: 16upx;
  68. $uni-spacing-col-lg: 24upx;
  69. /* 透明度 */
  70. $uni-opacity-disabled: 0.3; // 组件禁用态的透明度
  71. /* 文章场景相关 */
  72. $uni-color-title: #2C405A; // 文章标题颜色
  73. $uni-font-size-title:40upx;
  74. $uni-color-subtitle: #555555; // 二级标题颜色
  75. $uni-font-size-subtitle:36upx;
  76. $uni-color-paragraph: #3F536E; // 文章段落颜色
  77. $uni-font-size-paragraph:30upx;
  78. /* #ifndef APP-PLUS-NVUE */
  79. //IE盒子模型
  80. page,
  81. view,
  82. scroll-view,
  83. swiper,
  84. button,
  85. input,
  86. textarea,
  87. label,
  88. navigator,
  89. image {
  90. box-sizing: border-box !important;
  91. }
  92. //消除图片下边距
  93. image {
  94. vertical-align: top;
  95. }
  96. //主题色变量
  97. $theme-red: #ff393b;
  98. //水平弹性盒子
  99. @mixin fr($j:s,$a:h) {
  100. display: flex;
  101. @if $j == s {
  102. justify-content: flex-start;
  103. } @else if $j == e {
  104. justify-content: flex-end;
  105. } @else if $j == c {
  106. justify-content: center;
  107. } @else if $j == a {
  108. justify-content: space-around;
  109. } @else if $j == b {
  110. justify-content: space-between;
  111. }
  112. @if $a == h {
  113. align-items: stretch;
  114. } @else if $a == s {
  115. align-items: flex-start;
  116. } @else if $a == e {
  117. align-items: flex-end;
  118. } @else if $a == c {
  119. align-items: center;
  120. } @else if $a == b {
  121. align-items: baseline;
  122. }
  123. }
  124. //垂直弹性盒子
  125. @mixin fc($j:s,$a:h) {
  126. @include fr($j,$a);
  127. flex-direction: column;
  128. }
  129. //字体
  130. @mixin font($size,$color,$weight:normal) {
  131. color: $color !important;
  132. font-size: $size !important;
  133. font-weight: $weight !important;
  134. }
  135. //尺寸
  136. @mixin size($width,$height:$width) {
  137. width: $width !important;
  138. height: $height !important;
  139. }
  140. //阴影
  141. @mixin shadow($shuiping:0,$chuizhi:5upx,$mohu:10upx,$pianyi:0,$color:rgba(0,0,0,.2)) {
  142. box-shadow: $shuiping $chuizhi $mohu $pianyi $color;
  143. }
  144. //文本省略
  145. @mixin ell($line:1) {
  146. @if $line == 1 {
  147. overflow: hidden;
  148. white-space: nowrap;
  149. text-overflow: ellipsis;
  150. } @else {
  151. display: -webkit-box !important;
  152. overflow: hidden;
  153. text-overflow: ellipsis;
  154. word-break: break-all;
  155. -webkit-box-orient: vertical;
  156. -webkit-line-clamp: $line;
  157. }
  158. }
  159. //像素边框
  160. @mixin line($top:1,$right:1,$bottom:1,$left:1,$color:#ddd) {
  161. position: relative;
  162. &:after {
  163. content: " ";
  164. width: 200%;
  165. height: 200%;
  166. position: absolute;
  167. top: 0;
  168. left: 0;
  169. border-radius: inherit;
  170. transform: scale(0.5);
  171. transform-origin: 0 0;
  172. pointer-events: none;
  173. box-sizing: border-box;
  174. border: 0 $color solid;
  175. border-top-width: #{$top}px;
  176. border-right-width: #{$right}px;
  177. border-bottom-width: #{$bottom}px;
  178. border-left-width: #{$left}px;
  179. }
  180. }
  181. /* #endif */