-
zhangwei
2025-01-23 e5a77d6a551d13e4cf74624b31b0fa3e328b304d
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
<template>
    <!--本文件由FirstUI授权予四川政采招投标咨询有限公司(会员ID:1  63,营业执照号:9 15    101  313 320  0  61    93 K)专用,请尊重知识产权,勿私下传播,违者追究法律责任。-->
    <view class="fui-white__space-wrap" :class="['fui-white__space-'+(getHeight?'':getSize)]" :style="getStyles"
        @tap="handleClick">
        <slot></slot>
    </view>
</template>
 
<script>
    export default {
        emits: ['click'],
        name: "fui-white-space",
        props: {
            //small、default、large 默认优先使用全局配置
            size: {
                type: String,
                default: ''
            },
            height: {
                type: [Number, String],
                default: 0
            },
            background: {
                type: String,
                default: ''
            }
        },
        computed: {
            getSize() {
                const app = uni && uni.$fui && uni.$fui.fuiWhiteSpace;
                return this.size || (app && app.size) || 'default'
            },
            getHeight() {
                let style = ''
                const app = uni && uni.$fui && uni.$fui.fuiWhiteSpace;
                const h = Number(String(this.height || (app && app.height) || 0).replace('rpx', ''))
                if (h && h > 0) {
                    style += `height:${h}rpx;`
                }
                return style
            },
            getStyles() {
                const app = uni && uni.$fui && uni.$fui.fuiWhiteSpace;
                let style = `background:${this.background || (app && app.background) || 'transparent'};`
                style += this.getHeight;
                return style;
            }
        },
        methods: {
            handleClick() {
                this.$emit('click')
            }
        }
    }
</script>
 
<style scoped>
    .fui-white__space-wrap {
        /* #ifndef APP-NVUE */
        width: 100%;
        box-sizing: border-box;
        /* #endif */
    }
 
    .fui-white__space-small {
        height: 8rpx
    }
 
    .fui-white__space-default {
        height: 16rpx
    }
 
    .fui-white__space-large {
        height: 24rpx
    }
</style>