clearfix

  1. .clearfix() {
  2. &:after,
  3. &:before {
  4. content: "";
  5. display: table;
  6. }
  7. &:after {
  8. clear: both;
  9. }
  10. }

vertical-center

  1. @mixin utils-vertical-center {
  2. $selector: &;
  3. @at-root {
  4. #{$selector}::after {
  5. display: inline-block;
  6. content: "";
  7. height: 100%;
  8. vertical-align: middle
  9. }
  10. }
  11. }

ellipsis

  1. .ellipsis(@num: 1) {
  2. overflow: hidden;
  3. text-overflow: ellipsis;
  4. display: -webkit-box;
  5. -webkit-line-clamp: @num;
  6. -webkit-box-orient: vertical;
  7. }

user-select

  1. // sass
  2. @mixin utils-user-select($value) {
  3. -moz-user-select: $value;
  4. -webkit-user-select: $value;
  5. -ms-user-select: $value;
  6. }
  7. // less
  8. .user-select(@value: none) {
  9. -moz-user-select: @value;
  10. -webkit-user-select: @value;
  11. -ms-user-select: @value;
  12. }

arrow

  1. // 来自weui
  2. ._setArrow(@arrowsize, @borderColor, @borderWidth){
  3. display: inline-block;
  4. height: @arrowsize;
  5. width: @arrowsize;
  6. border-width: @borderWidth @borderWidth 0 0;
  7. border-color: @borderColor;
  8. border-style: solid;
  9. }
  10. // rotate(-45deg)
  11. .setArrow(@direction, @arrowsize, @borderColor, @borderWidth) when (@direction = top) {
  12. ._setArrow(@arrowsize, @borderColor, @borderWidth);
  13. transform: matrix(0.71,-0.71,0.71,0.71,0,0);
  14. }
  15. // rotate(45deg);
  16. .setArrow(@direction, @arrowsize, @borderColor,@borderWidth) when (@direction = right) {
  17. ._setArrow(@arrowsize, @borderColor, @borderWidth);
  18. transform: matrix(0.71,0.71,-0.71,0.71,0,0);
  19. position: relative;
  20. top: -2px;
  21. }
  22. // rotate(135deg);
  23. .setArrow(@direction, @arrowsize, @borderColor,@borderWidth) when (@direction = down) {
  24. ._setArrow(@arrowsize, @borderColor, @borderWidth);
  25. transform: matrix(-0.71,0.71,-0.71,-0.71,0,0);
  26. position: relative;
  27. top: -3px;
  28. }
  29. // rotate(-135deg);
  30. .setArrow(@direction, @arrowsize, @borderColor,@borderWidth) when (@direction = left) {
  31. ._setArrow(@arrowsize, @borderColor, @borderWidth);
  32. transform: matrix(-0.71,-0.71,0.71,-0.71,0,0);
  33. position: relative;
  34. top: -2px;
  35. }