曹睿
2025-04-25 ec1bef3a37e8dcdf22f1bf52e7c272a18306f4b9
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
<!-- [z-paging]上拉加载更多view -->
<template>
    <view class="zp-l-container" :class="{'zp-l-container-rpx':c.unit==='rpx','zp-l-container-px':c.unit==='px'}" :style="[c.customStyle]" @click="doClick">
        <template v-if="!c.hideContent">
            <!-- 底部加载更多没有更多数据分割线 -->
            <text v-if="c.showNoMoreLine&&finalStatus===M.NoMore" :class="{'zp-l-line-rpx':c.unit==='rpx','zp-l-line-px':c.unit==='px'}" :style="[{backgroundColor:zTheme.line[ts]},c.noMoreLineCustomStyle]" />
            <!-- 底部加载更多loading -->
            <!-- #ifndef APP-NVUE -->
            <image v-if="finalStatus===M.Loading&&!!c.loadingIconCustomImage"
                :src="c.loadingIconCustomImage" :style="[c.iconCustomStyle]" :class="{'zp-l-line-loading-custom-image':true,'zp-l-line-loading-custom-image-animated':c.loadingAnimated,'zp-l-line-loading-custom-image-rpx':c.unit==='rpx','zp-l-line-loading-custom-image-px':c.unit==='px'}" />
            <image v-if="finalStatus===M.Loading&&finalLoadingIconType==='flower'&&!c.loadingIconCustomImage.length"
                :class="{'zp-line-loading-image':true,'zp-line-loading-image-rpx':c.unit==='rpx','zp-line-loading-image-px':c.unit==='px'}" :style="[c.iconCustomStyle]" :src="zTheme.flower[ts]" />
            <!-- #endif -->
            <!-- #ifdef APP-NVUE -->
            <!-- 在nvue中底部加载更多loading使用系统自带的 -->
            <view>
                <loading-indicator v-if="finalStatus===M.Loading&&finalLoadingIconType!=='circle'" :class="{'zp-line-loading-image-rpx':c.unit==='rpx','zp-line-loading-image-px':c.unit==='px'}" :style="[{color:zTheme.indicator[ts]}]" :animating="true" />
            </view>
            <!-- #endif -->
            <!-- 底部加载更多文字 -->
            <text v-if="finalStatus===M.Loading&&finalLoadingIconType==='circle'&&!c.loadingIconCustomImage.length"
                class="zp-l-circle-loading-view" :class="{'zp-l-circle-loading-view-rpx':c.unit==='rpx','zp-l-circle-loading-view-px':c.unit==='px'}" :style="[{borderColor:zTheme.circleBorder[ts],borderTopColor:zTheme.circleBorderTop[ts]},c.iconCustomStyle]" />
            <text v-if="!c.isChat||(!c.chatDefaultAsLoading&&finalStatus===M.Default)||finalStatus===M.Fail" :class="{'zp-l-text-rpx':c.unit==='rpx','zp-l-text-px':c.unit==='px'}" :style="[{color:zTheme.title[ts]},c.titleCustomStyle]">{{ownLoadingMoreText}}</text>
            <!-- 底部加载更多没有更多数据分割线 -->
            <text v-if="c.showNoMoreLine&&finalStatus===M.NoMore" :class="{'zp-l-line-rpx':c.unit==='rpx','zp-l-line-px':c.unit==='px'}" :style="[{backgroundColor:zTheme.line[ts]},c.noMoreLineCustomStyle]" />
        </template>
    </view>
</template>
<script>
    import zStatic from '../js/z-paging-static'
    import Enum from '../js/z-paging-enum'
    export default {
        name: 'z-paging-load-more',
        data() {
            return {
                M: Enum.More,
                zTheme: {
                    title: { white: '#efefef', black: '#a4a4a4' },
                    line: { white: '#efefef', black: '#eeeeee' },
                    circleBorder: { white: '#aaaaaa', black: '#c8c8c8' },
                    circleBorderTop: { white: '#ffffff', black: '#444444' },
                    flower: { white: zStatic.base64FlowerWhite, black: zStatic.base64Flower },
                    indicator: { white: '#eeeeee', black: '#777777' }
                }
            };
        },
        props: ['zConfig'],
        computed: {
            ts() {
                return this.c.defaultThemeStyle;
            },
            // 底部加载更多配置
            c() {
                return this.zConfig || {};
            },
            // 底部加载更多文字
            ownLoadingMoreText() {
                return {
                    [this.M.Default]: this.c.defaultText,
                    [this.M.Loading]: this.c.loadingText,
                    [this.M.NoMore]: this.c.noMoreText,
                    [this.M.Fail]: this.c.failText,
                }[this.finalStatus];
            },
            // 底部加载更多状态
            finalStatus() {
                if (this.c.defaultAsLoading && this.c.status === this.M.Default) return this.M.Loading;
                return this.c.status;
            },
            // 加载更多icon类型
            finalLoadingIconType() {
                // #ifdef APP-NVUE
                return 'flower';
                // #endif
                return this.c.loadingIconType;
            }
        },
        methods: {
            // 点击了加载更多
            doClick() {
                this.$emit('doClick');
            }
        }
    }
</script>
 
<style scoped>
    @import "../css/z-paging-static.css";
 
    .zp-l-container {
        /* #ifndef APP-NVUE */
        clear: both;
        display: flex;
        /* #endif */
        flex-direction: row;
        align-items: center;
        justify-content: center;
    }
    .zp-l-container-rpx {
        height: 80rpx;
        font-size: 27rpx;
    }
    .zp-l-container-px {
        height: 40px;
        font-size: 14px;
    }
 
    .zp-l-line-loading-custom-image {
        color: #a4a4a4;
    }
    .zp-l-line-loading-custom-image-rpx {
        margin-right: 8rpx;
        width: 28rpx;
        height: 28rpx;
    }
    .zp-l-line-loading-custom-image-px {
        margin-right: 4px;
        width: 14px;
        height: 14px;
    }
    
    .zp-l-line-loading-custom-image-animated{
        /* #ifndef APP-NVUE */
        animation: loading-circle 1s linear infinite;
        /* #endif */
    }
 
    .zp-l-circle-loading-view {
        border: 3rpx solid #dddddd;
        border-radius: 50%;
        /* #ifndef APP-NVUE */
        animation: loading-circle 1s linear infinite;
        /* #endif */
        /* #ifdef APP-NVUE */
        width: 30rpx;
        height: 30rpx;
        /* #endif */
    }
    .zp-l-circle-loading-view-rpx {
        margin-right: 8rpx;
        width: 23rpx;
        height: 23rpx;
    }
    .zp-l-circle-loading-view-px {
        margin-right: 4px;
        width: 12px;
        height: 12px;
    }
 
    .zp-l-text-rpx {
        font-size: 30rpx;
        margin: 0rpx 6rpx;
    }
    .zp-l-text-px {
        font-size: 15px;
        margin: 0px 3px;
    }
 
    .zp-l-line-rpx {
        height: 1px;
        width: 100rpx;
        margin: 0rpx 10rpx;
    }
    .zp-l-line-px {
        height: 1px;
        width: 50px;
        margin: 0rpx 5px;
    }
 
    /* #ifndef APP-NVUE */
    @keyframes loading-circle {
        0% {
            -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
        }
        100% {
            -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
        }
    }
    /* #endif */
</style>