longyvfengyun
2023-11-29 11713ebaf140cce03b439146aa63677d725112e7
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
102
103
104
105
106
<script setup>
    import {computed} from "vue";
 
    const props = defineProps({
        type: {
            type: String,
            default: "",
        },
        title: {
            type: String,
            default: "",
        },
        noHeader: {
            type: Boolean,
            default: false,
        },
        noHeaderBg: {
            type: Boolean,
            default: false,
        },
        size: {
            type: String,
            default: "",
        },
    });
 
    const sizeClass = computed(()=>{
        let size = props.size;
        let result = "";
        switch (size) {
            case "mini":
                result = "flex-box-mini";
                break;
        }
        return result;
    });
</script>
 
<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">
            <slot name="header"></slot>
        </div>
        <div class="flex-box-body">
            <slot></slot>
        </div>
        <div class="flex-box-footer">
            <slot name="footer"></slot>
        </div>
    </div>
</template>
 
<style lang="less" scoped>
@border-color: #00feff;
@size: 32px;
.flex-box {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-image: radial-gradient(#151f4140, rgba(23, 54, 140, 0.25));
 
    >.flex-box-border {
        position: absolute;
        z-index: 9;
        width: 20px;
        height: 20px;
        box-sizing: border-box;
 
        &.border-top-left {
            top: 0;
            left: 0;
            border-top: 2px solid @border-color;
            border-left: 2px solid @border-color;
        }
 
        &.border-top-right {
            top: 0;
            right: 0;
            border-top: 2px solid @border-color;
            border-right: 2px solid @border-color;
        }
 
        &.border-bottom-left {
            bottom: 0;
            left: 0;
            border-bottom: 2px solid @border-color;
            border-left: 2px solid @border-color;
        }
 
        &.border-bottom-right {
            bottom: 0;
            right: 0;
            border-bottom: 2px solid @border-color;
            border-right: 2px solid @border-color;
        }
    }
    >.flex-box-body {
        flex: 1;
    }
}
</style>