wzp
2022-02-21 2667d6931e0f85f3dda26238330d9c45385025cf
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
<!-- 下拉刷新区域 -->
<template>
    <view v-if="mOption.use" class="mescroll-downwarp" :style="{'background':mOption.bgColor,'color':mOption.textColor}">
        <view class="downwarp-content">
            <view v-if="isDownLoading" class="downwarp-progress"></view>
            <view v-else class="downwarp-arrow" :style="{ transform: downRotate }"></view>
            <view class="downwarp-tip">{{ downText }}</view>
        </view>
    </view>
</template>
 
<script>
export default {
    props: {
        option: Object, // down的配置项
        type: Number // 下拉状态(inOffset:1, outOffset:2, showLoading:3, endDownScroll:4)
    },
    computed: {
        // 支付宝小程序需写成计算属性,prop定义default仍报错
        mOption() {
            return this.option || {};
        },
        // 是否在加载中
        isDownLoading() {
            return this.type === 3;
        },
        // 旋转的角度
        downRotate() {
            return this.type === 2 ? 'rotate(-180deg)' : 'rotate(0deg)';
        },
        // 文本提示
        downText() {
            switch (this.type) {
                case 1:
                    return this.mOption.textInOffset;
                case 2:
                    return this.mOption.textOutOffset;
                case 3:
                    return this.mOption.textLoading;
                case 4:
                    return this.mOption.textLoading;
                default:
                    return this.mOption.textInOffset;
            }
        }
    }
};
</script>
 
<style>
@import '../../../mescroll-uni/components/mescroll-down.css';
@import './mescroll-down.css';
</style>