绿满眶商城微信小程序-uniapp
xiangpei
2025-05-09 c3e6cdbb29580e77444541c7953aca33581a4267
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<template>
    <view class="uni-load-more">
        <view class="uni-load-more__img" v-show="status === 'loading' && showIcon">
            <view class="load1">
                <view :style="{ background: color }"></view>
                <view :style="{ background: color }"></view>
                <view :style="{ background: color }"></view>
                <view :style="{ background: color }"></view>
            </view>
            <view class="load2">
                <view :style="{ background: color }"></view>
                <view :style="{ background: color }"></view>
                <view :style="{ background: color }"></view>
                <view :style="{ background: color }"></view>
            </view>
            <view class="load3">
                <view :style="{ background: color }"></view>
                <view :style="{ background: color }"></view>
                <view :style="{ background: color }"></view>
                <view :style="{ background: color }"></view>
            </view>
        </view>
        <text class="uni-load-more__text" :style="{ color: color }" v-if="showText">
            {{ status === 'more' ? contentText.contentdown : status === 'loading' ? contentText.contentrefresh : contentText.contentnomore }}
        </text>
    </view>
</template>
 
<script>
export default {
    name: 'uni-load-more',
    props: {
        status: {
            //上拉的状态:more-loading前;loading-loading中;noMore-没有更多了
            type: String,
            default: 'more'
        },
        showIcon: {
            type: Boolean,
            default: true
        },
        showText: {
            type: Boolean,
            default: true
        },
        color: {
            type: String,
            default: '#777777'
        },
        contentText: {
            type: Object,
            default() {
                return {
                    contentdown: '上拉显示更多',
                    contentrefresh: '正在加载...',
                    contentnomore: '没有更多数据了'
                };
            }
        }
    },
    data() {
        return {};
    }
};
</script>
 
<style>
@charset "UTF-8";
 
.uni-load-more {
    display: flex;
    flex-direction: row;
    height: 80rpx;
    align-items: center;
    justify-content: center;
}
 
.uni-load-more__text {
    font-size: 28rpx;
    color: #999;
}
 
.uni-load-more__img {
    height: 24px;
    width: 24px;
    margin-right: 10px;
}
 
.uni-load-more__img > view {
    position: absolute;
}
 
.uni-load-more__img > view view {
    width: 6px;
    height: 2px;
    border-top-left-radius: 1px;
    border-bottom-left-radius: 1px;
    background: #999;
    position: absolute;
    opacity: 0.2;
    transform-origin: 50%;
    animation: load 1.56s ease infinite;
}
 
.uni-load-more__img > view view:nth-child(1) {
    transform: rotate(90deg);
    top: 2px;
    left: 9px;
}
 
.uni-load-more__img > view view:nth-child(2) {
    transform: rotate(180deg);
    top: 11px;
    right: 0;
}
 
.uni-load-more__img > view view:nth-child(3) {
    transform: rotate(270deg);
    bottom: 2px;
    left: 9px;
}
 
.uni-load-more__img > view view:nth-child(4) {
    top: 11px;
    left: 0;
}
 
.load1,
.load2,
.load3 {
    height: 24px;
    width: 24px;
}
 
.load2 {
    transform: rotate(30deg);
}
 
.load3 {
    transform: rotate(60deg);
}
 
.load1 view:nth-child(1) {
    animation-delay: 0s;
}
 
.load2 view:nth-child(1) {
    animation-delay: 0.13s;
}
 
.load3 view:nth-child(1) {
    animation-delay: 0.26s;
}
 
.load1 view:nth-child(2) {
    animation-delay: 0.39s;
}
 
.load2 view:nth-child(2) {
    animation-delay: 0.52s;
}
 
.load3 view:nth-child(2) {
    animation-delay: 0.65s;
}
 
.load1 view:nth-child(3) {
    animation-delay: 0.78s;
}
 
.load2 view:nth-child(3) {
    animation-delay: 0.91s;
}
 
.load3 view:nth-child(3) {
    animation-delay: 1.04s;
}
 
.load1 view:nth-child(4) {
    animation-delay: 1.17s;
}
 
.load2 view:nth-child(4) {
    animation-delay: 1.3s;
}
 
.load3 view:nth-child(4) {
    animation-delay: 1.43s;
}
 
@-webkit-keyframes load {
    0% {
        opacity: 1;
    }
 
    100% {
        opacity: 0.2;
    }
}
</style>