mixin.scss 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. // 水平垂直居中
  2. @mixin mid($x: 50%, $y: 50%) {
  3. position: absolute;
  4. left: $x;
  5. top: $y;
  6. transform: translate3d(-$x, -$y, 0);
  7. }
  8. // 水平垂直居中(margin版)
  9. @mixin marMid($x, $y, $mx, $my) {
  10. position: absolute;
  11. left: $x;
  12. top: $y;
  13. margin-left: $mx;
  14. margin-top: $my;
  15. }
  16. // 水平居中
  17. @mixin xMid($x: 50%) {
  18. position: absolute;
  19. left: $x;
  20. transform: translate3d(-$x, 0, 0);
  21. }
  22. // 垂直居中
  23. @mixin yMid($y: 50%) {
  24. position: absolute;
  25. top: $y;
  26. transform: translate3d(0, -$y, 0);
  27. }
  28. // 字体大小、行高、字体
  29. @mixin font($size, $line-height, $family: 'Microsoft YaHei') {
  30. font: #{$size}/#{$line-height} $family;
  31. }
  32. // 字体大小、字体颜色、字体粗细
  33. @mixin fcw($size, $color, $weight: 400) {
  34. font-size: $size;
  35. color: $color;
  36. font-weight: $weight;
  37. }
  38. // 文字省略
  39. @mixin textSinOmit() {
  40. overflow: hidden;
  41. text-overflow: ellipsis;
  42. white-space: nowrap;
  43. }
  44. // 文字多行省略
  45. @mixin textMulOmit($col: 2) {
  46. overflow: hidden;
  47. text-overflow: ellipsis;
  48. display: -webkit-box;
  49. -webkit-line-clamp: $col;
  50. -webkit-box-orient: vertical;
  51. }
  52. // 宽高
  53. @mixin wh($width, $height) {
  54. width: $width;
  55. height: $height;
  56. }
  57. @mixin ossBg($name) {
  58. background-image: url('https://birdseye-img.sysuimars.com/birdseye-look-vue/' + $name);
  59. background-size: 100% 100%;
  60. }
  61. @mixin PingFang($color:#FFFFFF, $weight:bold) {
  62. font-family: PingFang-SC-Regular;
  63. font-weight: $weight;
  64. color: $color;
  65. }
  66. @mixin JXZK($color:#FFFFFF, $weight:bold) {
  67. font-family: jiangxizhuokai;
  68. font-weight: $weight;
  69. color: $color;
  70. }
  71. @mixin CKTK($color:#FFFFFF, $weight:bold) {
  72. font-family: CKTKingkong;
  73. font-weight: $weight;
  74. color: $color;
  75. }
  76. @mixin Title() {
  77. position: relative;
  78. width: 147rpx;
  79. height: 56rpx;
  80. }
  81. @mixin TitleBg($bgName) {
  82. z-index: 0;
  83. position: absolute;
  84. bottom: 0rpx;
  85. width: 147rpx;
  86. height: 42rpx;
  87. @include ossBg($bgName);
  88. }
  89. @mixin TitleText($color:#000000) {
  90. text-align: center;
  91. width: 100%;
  92. position: absolute;
  93. z-index: 1;
  94. @include PingFang($color);
  95. font-size: 30rpx;
  96. }
  97. @mixin FlexRowCenter($justify-content:space-around) {
  98. display: flex;
  99. align-items: center;
  100. justify-content: $justify-content;
  101. }
  102. @mixin LeftTop($left: 0, $top: 0) {
  103. position: absolute;
  104. left: $left;
  105. top: $top;
  106. }