loading.vue
3.37 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<template>
<view class="mask mask-show u_loading" v-if="loadingShow" @touchmove.stop.prevent="preventTouchMove">
<!-- 加载动画开始 -->
<view class="preloader">
<view class="loader">
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
</view>
</view>
<!-- 加载动画结束 -->
<view class="title">{{ $t('common.loading') }}</view>
</view>
</template>
<script scoped="true">
import { mapState, mapMutations } from 'vuex';
export default {
computed: {
...mapState(['loadingShow'])
},
methods:{
preventTouchMove(){
console.log('stop user scroll it!');
return;
}
}
};
</script>
<style lang="scss" scoped>
.u_loading{
&.mask {
/* pointer-events: none; */
position: fixed;
z-index: 99999;
top: 0;
left: 0;
right: 0;
bottom: 0;
height: 100vh;
width: 100vw;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
align-items: center;
flex-wrap: wrap;
}
&.mask-show {
background: rgba(255,255,255, 0.3);
}
.title {
color: #666;
font-size: 28rpx;
margin-top: 40rpx;
}
.loader {
width: 45px;
position: relative;
}
.loader view {
display: block;
position: absolute;
bottom: 0px;
width: 7px;
height: 5px;
background: coral;
-webkit-animation: loader 1.5s infinite ease-in-out;
animation: loader 1.5s infinite ease-in-out;
}
.loader view:nth-child(2) {
left: 11px;
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s;
}
.loader view:nth-child(3) {
left: 22px;
-webkit-animation-delay: 0.4s;
animation-delay: 0.4s;
}
.loader view:nth-child(4) {
left: 33px;
-webkit-animation-delay: 0.6s;
animation-delay: 0.6s;
}
.loader view:nth-child(5) {
left: 44px;
-webkit-animation-delay: 0.8s;
animation-delay: 0.8s;
}
@-webkit-keyframes loader {
0% {
height: 5px;
-webkit-transform: translateY(0px);
transform: translateY(0px);
background: coral;
}
25% {
height: 30px;
-webkit-transform: translateY(15px);
transform: translateY(15px);
background: cornflowerblue;
}
50% {
height: 5px;
-webkit-transform: translateY(0px);
transform: translateY(0px);
background: cornflowerblue;
}
100% {
height: 5px;
-webkit-transform: translateY(0px);
transform: translateY(0px);
background: coral;
}
}
@keyframes loader {
0% {
height: 5px;
-webkit-transform: translateY(0px);
transform: translateY(0px);
background: coral;
}
25% {
height: 30px;
-webkit-transform: translateY(15px);
transform: translateY(15px);
background: cornflowerblue;
}
50% {
height: 5px;
-webkit-transform: translateY(0px);
transform: translateY(0px);
background: cornflowerblue;
}
100% {
height: 5px;
-webkit-transform: translateY(0px);
transform: translateY(0px);
background: coral;
}
}
}
</style>