健康同学微信公众号h5项目
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

119 行
2.4KB

  1. // mixin
  2. @use "sass:math";
  3. $background: #f2f4f5;
  4. $blue: #2599ff;
  5. $next: #8bc6fa;
  6. $border_color: #d1d1d1;
  7. $green: #189b3b;
  8. $next_green: #8ccd9d;
  9. $red: #ff8c8c;
  10. $com_blue: #2ea7e0;
  11. $com_red: #ff5f8b;
  12. $com_light_green: #8dc21f;
  13. // 灰色线条
  14. $lineGray: #F5F5F5;
  15. // 清除浮动
  16. @mixin clearfix {
  17. &:after {
  18. content: "";
  19. display: table;
  20. clear: both;
  21. }
  22. }
  23. // 多行隐藏
  24. @mixin textoverflow($clamp:1) {
  25. display: block;
  26. overflow: hidden;
  27. text-overflow: ellipsis;
  28. -o-text-overflow: ellipsis;
  29. display: -webkit-box;
  30. -webkit-line-clamp: $clamp;
  31. /*! autoprefixer: ignore next */
  32. -webkit-box-orient: vertical;
  33. }
  34. //flex box
  35. @mixin flexbox($jc:space-between, $ai:center, $fd:row, $fw:nowrap) {
  36. display: flex;
  37. display: -webkit-flex;
  38. flex: 1;
  39. justify-content: $jc;
  40. -webkit-justify-content: $jc;
  41. align-items: $ai;
  42. -webkit-align-items: $ai;
  43. flex-direction: $fd;
  44. -webkit-flex-direction: $fd;
  45. flex-wrap: $fw;
  46. -webkit-flex-wrap: $fw;
  47. }
  48. // 雪碧图路径
  49. /* @mixin icon($spriteUrl) {
  50. background: transparent url($spriteUrl) no-repeat;
  51. background-size: 400px 400px;
  52. } */
  53. @mixin icon {
  54. background: transparent url('~@/assets/icon.png') no-repeat;
  55. background-size: 400px 400px;
  56. }
  57. @mixin bgPosition(
  58. $spriteWidth,
  59. $spriteHeight,
  60. $iconWidth,
  61. $iconHeight,
  62. $iconX,
  63. $iconY
  64. ) {
  65. background-position: (
  66. math.div($iconX ,($spriteWidth - $iconWidth)) * 100%
  67. math.div($iconY,($spriteHeight - $iconHeight)) * 100%
  68. );
  69. }
  70. @mixin icon_position($iconWidth, $iconHeight, $iconX, $iconY) {
  71. $spriteWidth: 400;
  72. $spriteHeight: 400;
  73. @include bgPosition(
  74. $spriteWidth,
  75. $spriteHeight,
  76. $iconWidth,
  77. $iconHeight,
  78. $iconX,
  79. $iconY
  80. );
  81. }
  82. @mixin border {
  83. position: absolute;
  84. box-sizing: border-box;
  85. content: ' ';
  86. pointer-events: none;
  87. top: -50%;
  88. right: -50%;
  89. bottom: -50%;
  90. left: -50% !important;
  91. border-bottom: 1px solid $border_color;
  92. -webkit-transform: scale(.5);
  93. transform: scale(.5);
  94. }
  95. @mixin colorAndFont($color, $fontSize) {
  96. color: $color;
  97. font-size: $fontSize + px;
  98. }
  99. @mixin center {
  100. display: flex;
  101. justify-content: center;
  102. align-items: center;
  103. }
  104. @mixin bgimg($path, $width, $height) {
  105. background-image: $path;
  106. background-size: $width, $height;
  107. width: $width + px;
  108. height: $height + px;
  109. display: flex;
  110. justify-content: center;
  111. align-items: center;
  112. }