whychdw
2021-01-18 cc12d58f9b7f5ab10b7c47f412508d99a143615e
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>
    <div class="flex-box">
        <div class="flex-box-border border-top-left"></div>
        <div class="flex-box-border border-top-right"></div>
        <div class="flex-box-border border-bottom-left"></div>
        <div class="flex-box-border border-bottom-right"></div>
        <div class="flex-box-header" v-if="!noHeader" :class="{'no-header-bg':noHeaderBg}">
            <i class="iconfont el-icon-fold"></i>
            <span class="header-text">{{title}}</span>
        </div>
        <div class="flex-box-body">
            <slot></slot>
        </div>
        <div class="flex-box-footer">
            <slot name="footer"></slot>
        </div>
    </div>
</template>
 
<script>
export default {
    name: "FlexBox",
    props: {
        title: {
            type: String,
            default: "",
        },
        noHeader: {
            type: Boolean,
            default: false,
        },
        noHeaderBg: {
            type: Boolean,
            default: false
        },
    },
}
</script>
 
<style scoped>
    .flex-box {
        position: relative;
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    .flex-box-border{
        position: absolute;
        display: inline-block;
        z-index: 9;
    }
    .flex-box-border.border-top-left {
        top: 0;
        left: 0;
        border-top: 2px solid #00FEFF;
        border-left: 2px solid #00FEFF;
    }
    .flex-box-border.border-top-right {
        top: 0;
        right: 0;
        border-top: 2px solid #00FEFF;
        border-right: 2px solid #00FEFF;
    }
    .flex-box-border.border-bottom-left {
        bottom: 0;
        left: 0;
        border-bottom: 2px solid #00FEFF;
        border-left: 2px solid #00FEFF;
    }
    .flex-box-border.border-bottom-right {
        bottom: 0;
        right: 0;
        border-bottom: 2px solid #00FEFF;
        border-right: 2px solid #00FEFF;
    }
    .flex-box-header {
        padding: 12px 0;
        font-size: 14px;
        color: #00fefe;
        font-weight: bold;
    }
    .flex-box-header.no-header-bg {
        background: none;
        padding: 8px 0;
    }
    .flex-box-header .iconfont {
        font-size: 10px;
        margin-right: 8px;
        margin-left: 16px;
        transform: rotate(90deg);
    }
    .header-text {
        font-weight: bold;
    }
    .flex-box-body {
        position: relative;
        flex: 1;
        overflow: hidden;
        box-sizing: border-box;
    }
</style>