-
zhangwei
2025-03-05 16213c0f85aa3ac8317797bf4a05fd12940e16d3
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
<template>
    <view class="u-box" :style="[{height: height}, addStyle(customStyle)]">
        <view class="u-box__left" :style="{borderRadius: borderRadius, backgroundColor: bgColors[0]}">
            <slot name="left">左</slot>
        </view>
        <view class="u-box__gap" :style="{width: gap, height: height}"></view>
        <view class="u-box__right">
            <view class="u-box__right-top" :style="{borderRadius: borderRadius, backgroundColor: bgColors[1]}">
                <slot name="rightTop">右上</slot>
            </view>
            <view class="u-box__right-gap" :style="{height: gap}"></view>
            <view class="u-box__right-bottom" :style="{borderRadius: borderRadius, backgroundColor: bgColors[2]}">
                <slot name="rightBottom">右下</slot>
            </view>
        </view>
    </view>
</template>
 
<script>
    import { propsBox } from './props';
    import { mpMixin } from '../../libs/mixin/mpMixin';
    import { mixin } from '../../libs/mixin/mixin';
    import { addStyle } from '../../libs/function/index';
    import test from '../../libs/function/test';
    /**
     * box 盒子
     * @description box盒子一般为左边一个盒子,右侧两个等高的半盒组成,常用于App首页座位重点突出。
     * @tutorial https://uview-plus.jiangruyi.com/components/box.html
     * @property {Array}    bgColors            背景色
     * @property {String}    height                高度
     * @property {String}    borderRadius        圆角
     * @property {Object}   customStyle            定义需要用到的外部样式
     * 
     * @event {Function}            click            点击cell列表时触发
     * @example <up-box colors=['blue', 'red', 'yellow'] height="200px"></up-box>
     */
    export default {
        name: 'up-box',
        data() {
            return {
            }
        },
        mixins: [mpMixin, mixin, propsBox],
        computed: {
        },
        emits: [],
        methods: {
            addStyle,
        }
    }
</script>
 
<style lang="scss" scoped>
    @import "../../libs/css/components.scss";
 
    .u-box {
        /* #ifndef APP-NVUE */
        /* #endif */
        @include flex();
        flex: 1;
 
        &__left {
            @include flex();
            justify-content: center;
            align-items: center;
            flex: 1;
        }
        &__gap {
            @include flex();
            flex-direction: column;
        }
        &__right {
            @include flex();
            flex-direction: column;
            flex: 1;
        }
 
        &__right-top {
            @include flex();
            flex: 1;
            justify-content: center;
            align-items: center;
        }
 
        &__right-bottom {
            @include flex();
            flex: 1;
            justify-content: center;
            align-items: center;
        }
    }
</style>