啊鑫
7 天以前 fca192d3c38c5dcfbb6ace8bc71d6078f6a079b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
@import '../style/var';
 
.van-loading {
  position: relative;
  color: @loading-spinner-color;
  font-size: 0;
  vertical-align: middle;
 
  &__spinner {
    position: relative;
    display: inline-block;
    width: @loading-spinner-size;
    // compatible for 1.x, users may set width or height in root element
    max-width: 100%;
    height: @loading-spinner-size;
    max-height: 100%;
    vertical-align: middle;
    animation: van-rotate @loading-spinner-animation-duration linear infinite;
 
    &--spinner {
      animation-timing-function: steps(12);
 
      i {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
 
        &::before {
          display: block;
          width: 2px;
          height: 25%;
          margin: 0 auto;
          background-color: currentColor;
          border-radius: 40%;
          content: ' ';
        }
      }
    }
 
    &--circular {
      animation-duration: 2s;
    }
  }
 
  &__circular {
    display: block;
    width: 100%;
    height: 100%;
 
    circle {
      animation: van-circular 1.5s ease-in-out infinite;
      stroke: currentColor;
      stroke-width: 3;
      stroke-linecap: round;
    }
  }
 
  &__text {
    display: inline-block;
    margin-left: @padding-xs;
    color: @loading-text-color;
    font-size: @loading-text-font-size;
    vertical-align: middle;
  }
 
  &--vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
 
    .van-loading__text {
      margin: @padding-xs 0 0;
    }
  }
}
 
@keyframes van-circular {
  0% {
    stroke-dasharray: 1, 200;
    stroke-dashoffset: 0;
  }
 
  50% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -40;
  }
 
  100% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -120;
  }
}
 
.generate-spinner(@n, @i: 1) when (@i =< @n) {
  .van-loading__spinner--spinner i:nth-of-type(@{i}) {
    transform: rotate(@i * 30deg);
    opacity: 1 - (0.75 / 12) * (@i - 1);
  }
  .generate-spinner(@n, (@i + 1));
}
.generate-spinner(12);