uni.scss 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. // 引入uView UI全局 scss 变量文件
  14. @import '@/uni_modules/vk-uview-ui/theme.scss';
  15. /* 颜色变量 */
  16. /* 行为相关颜色 */
  17. $uni-color-primary: #006af4;
  18. $uni-color-success: #4cd964;
  19. $uni-color-warning: #f0ad4e;
  20. $uni-color-error: #FA5151;
  21. /* 文字基本颜色 */
  22. $uni-text-color: #000;//基本色
  23. $uni-text-color-inverse: #fff;//反色
  24. $uni-text-color-grey: #999; //辅助灰色,如加载更多的提示信息
  25. $uni-text-color-placeholder: #808080;
  26. $uni-text-color-disable:#c0c0c0;
  27. /* 背景颜色 */
  28. $uni-bg-color:#f7f7f7;
  29. $uni-bg-color-grey:#ffffff;
  30. $uni-bg-color-hover:#f1f1f1; //点击状态颜色
  31. $uni-bg-color-mask:rgba(0, 0, 0, 0.4); //遮罩颜色
  32. /* 边框颜色 */
  33. $uni-border-color:#c8c7cc;
  34. /* 标题尺寸 */
  35. $uni-title-font-size-1: 36rpx;
  36. $uni-title-font-size-2: 26rpx;
  37. $uni-title-font-size-3: 24rpx;
  38. /* 文字尺寸 */
  39. $uni-font-size-1: 24rpx;
  40. $uni-font-size-2: 20rpx;
  41. $uni-font-size-3: 18rpx;
  42. $uni-font-size-4: 16rpx;
  43. $uni-font-size-5: 14rpx;
  44. $uni-font-size-6: 12rpx;
  45. /* 卡片圆角 */
  46. $uni-card-border-radius: 20rpx;
  47. // 全尺寸背景图片
  48. @mixin backgroundImg($url) {
  49. background-image: url($url);
  50. background-repeat: no-repeat;
  51. background-size: 100% 100%;
  52. }
  53. // 滚动条梅花
  54. @mixin scrollbar() {
  55. // 滚动条整体部分
  56. &::-webkit-scrollbar {
  57. width: 6px;
  58. height: 6px;
  59. }
  60. // 滚动条的轨道的两端按钮,允许通过点击微调小方块的位置。
  61. &::-webkit-scrollbar-button {
  62. display: none;
  63. }
  64. // 滚动条的轨道(里面装有Thumb)
  65. &::-webkit-scrollbar-track {
  66. background: transparent;
  67. }
  68. // 滚动条的轨道(里面装有Thumb)
  69. &::-webkit-scrollbar-track-piece {
  70. background-color: transparent;
  71. }
  72. // 滚动条里面的小方块,能向上向下移动(或往左往右移动,取决于是垂直滚动条还是水平滚动条)
  73. &::-webkit-scrollbar-thumb {
  74. background: rgba(144, 147, 153, 0.3);
  75. cursor: pointer;
  76. border-radius: 4px;
  77. }
  78. // 边角,即两个滚动条的交汇处
  79. &::-webkit-scrollbar-corner {
  80. display: none;
  81. }
  82. // 两个滚动条的交汇处上用于通过拖动调整元素大小的小控件
  83. &::-webkit-resizer {
  84. display: none;
  85. }
  86. }
  87. // 单行文字溢出
  88. @mixin text-overflow() {
  89. overflow: hidden;
  90. text-overflow: ellipsis;
  91. white-space: nowrap;
  92. }
  93. // 多行文字溢出
  94. @mixin text-line-overflow($line) {
  95. display: -webkit-box;
  96. -webkit-box-orient: vertical;
  97. -webkit-line-clamp: $line;
  98. overflow: hidden;
  99. }
  100. // 顶部悬停
  101. @mixin topMagnet() {
  102. position: sticky;
  103. top: 0;
  104. z-index: 999;
  105. }
  106. /**
  107. * 底部悬停
  108. * 使用该样式,会使元素脱离文档高度,致使出现内容被遮挡。需在其同层条件下新增一个元素,与其高度保持一致,保证高度不会丢失
  109. */
  110. @mixin bottomMagnet() {
  111. position: fixed;
  112. bottom: 0;
  113. width: 100%;
  114. }