Houjie
2025-04-11 1bf977929dd324f3ac64b70debd8a79443c54392
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
<template>
    <view>
        <cu-custom bgColor="bg-gradual-blue" :isBack="true"><block slot="backText">返回</block><block slot="content">加载</block>
            <block slot="right">
                <view class="action">
                    <view class="cu-load load-cuIcon" :class="!isLoad?'loading':'over'"></view>
                </view>
            </block>
        </cu-custom>
        <view class="cu-bar bg-white">
            <view class="action">
                <text class="cuIcon-title text-blue"></text>背景
            </view>
        </view>
        <view class="cu-load bg-blue" :class="!isLoad?'loading':'over'"></view>
        <view class="cu-bar bg-white margin-top">
            <view class="action">
                <text class="cuIcon-title text-blue"></text>加载状态
            </view>
            <view class="action">
                <switch @change="isLoading" :class="isLoad?'checked':''"></switch>
            </view>
        </view>
        <view class="cu-load bg-grey" :class="!isLoad?'loading':'over'"></view>
        <view class="cu-bar bg-white margin-top">
            <view class="action">
                <text class="cuIcon-title text-blue"></text>加载错误
            </view>
        </view>
        <view class="cu-load bg-red erro"></view>
 
        <view class="cu-bar bg-white margin-top">
            <view class="action">
                <text class="cuIcon-title text-blue"></text>弹框加载
            </view>
            <view class="action">
                <button class="cu-btn bg-green shadow" @tap="LoadModal">
                    点我
                </button>
            </view>
        </view>
        <view class="cu-load load-modal" v-if="loadModal">
            <!-- <view class="cuIcon-emojifill text-orange"></view> -->
            <image src="/static/logo.png" mode="aspectFit"></image>
            <view class="gray-text">加载中...</view>
        </view>
        <view class="cu-bar bg-white margin-top">
            <view class="action">
                <text class="cuIcon-title text-blue"></text>进度条加载
            </view>
            <view class="action">
                <button class="cu-btn bg-green shadow" @tap="LoadProgress">
                    点我
                </button>
            </view>
        </view>
        <view class="load-progress" :class="loadProgress!=0?'show':'hide'" :style="[{top:CustomBar+'px'}]">
            <view class="load-progress-bar bg-green" :style="[{transform: 'translate3d(-' + (100-loadProgress) + '%, 0px, 0px)'}]"></view>
            <view class="load-progress-spinner text-green"></view>
        </view>
    </view>
</template>
 
 
<script>
    export default {
        data() {
            return {
                CustomBar: this.CustomBar,
                isLoad:false,
                loadModal: false,
                loadProgress: 0
            };
        },
        methods: {
            isLoading(e) {
                this.isLoad = e.detail.value;
            },
            LoadModal(e) {
                this.loadModal = true;
                setTimeout(() => {
                    this.loadModal = false;
                }, 2000)
            },
            LoadProgress(e) {
                this.loadProgress = this.loadProgress + 3;
                if (this.loadProgress < 100) {
                    setTimeout(() => {
                        this.LoadProgress();
                    }, 100)
                } else {
                    this.loadProgress = 0;
                }
            }
        }
    }
</script>
 
<style>
 
</style>