-
zhangwei
2024-08-21 9efb46fe04b3bb9098e92979ae2c658256446f25
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
<template>
    <!--本文件由FirstUI授权予四川政采招投标咨询有限公司(会员ID:  163,营业执照号:  9 151 0 1 313 3   2   00   6 193K)专用,请尊重知识产权,勿私下传播,违者追究法律责任。-->
    <view class="fui-wing__blank-wrap"
        :class="[radius?'fui-wing__blank-hidden':'',getPadding?'':`fui-wing__blank-${getSize}`]" :style="getStyles"
        @tap="handleClick">
        <slot></slot>
    </view>
</template>
 
<script>
    export default {
        name: "fui-wing-blank",
        emits: ['click'],
        props: {
            //small、default、large
            size: {
                type: String,
                default: ''
            },
            gap: {
                type: [Number, String],
                default: 0
            },
            background: {
                type: String,
                default: ''
            },
            radius: {
                type: [Number, String],
                default: 0
            },
            marginTop: {
                type: [Number, String],
                default: 0
            },
            marginBottom: {
                type: [Number, String],
                default: 0
            }
        },
        computed: {
            getSize() {
                const app = uni && uni.$fui && uni.$fui.fuiWingBlank;
                return this.size || (app && app.size) || 'default'
            },
            getPadding() {
                let styles = '';
                const app = uni && uni.$fui && uni.$fui.fuiWingBlank;
                const padding = Number(this.gap || (app && app.gap) || 0)
                if (padding && padding > 0) {
                    styles += `padding:0 ${padding}rpx;`
                }
                return styles
            },
            getStyles() {
                const app = uni && uni.$fui && uni.$fui.fuiWingBlank;
                let styles =
                    `background:${this.background || (app && app.background) || 'transparent'};border-radius:${this.radius}rpx;margin-top:${this.marginTop}rpx;margin-bottom:${this.marginBottom}rpx;`;
                styles += this.getPadding;
                return styles
            }
        },
        methods: {
            handleClick() {
                this.$emit('click')
            }
        }
    }
</script>
 
<style scoped>
    .fui-wing__blank-wrap {
        /* #ifndef APP-NVUE */
        width: 100%;
        box-sizing: border-box;
        /* #endif */
    }
 
    .fui-wing__blank-hidden {
        overflow: hidden;
    }
 
    .fui-wing__blank-small {
        padding: 0 16rpx;
    }
 
    .fui-wing__blank-default {
        padding: 0 24rpx;
    }
 
    .fui-wing__blank-large {
        padding: 0 32rpx;
    }
</style>