he wei
2025-06-06 895129470d7ee48183fc15b9ee18ef0880503e5d
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<template>
    <div class="content-box-container" :class="{'content-box-hide': hide}">
        <div class="toggle-flag" v-if="toggle" @click="toggleChange">
            <i class="el-icon-arrow-left"></i>
        </div>
        <div class="content-box" :class="{'no-border': noborder}" v-show="!hide">
            <div class="content-box-title" :class="getTitlePos" v-if="!noHeader">
                <slot name="title">{{title}}</slot>
 
            </div>
            <div class="content-box-content">
                <slot></slot>
            </div>
            <div class="content-box-footer">
                <slot name="footer"></slot>
            </div>
        </div>
        <div class="box-tools box-tools-contain">
            <slot name="box-tools"></slot>
        </div>
    </div>
</template>
 
<script>
    export default {
        name: 'contentBox',
        props: {
            titleLeft: {
                type: Boolean,
                default: false
            },
            title: {
                type: String,
                default: '头部信息'
            },
            noborder: {
                type: Boolean,
                default: false
            },
            noHeader: {
                type: Boolean,
                default: false
            },
            toggle: {
                type: Boolean,
                default: false
            }
        },
        data() {
            return {
                hide: false
            }
        },
        methods: {
            toggleChange() {
                this.hide = this.hide ? false : true;
                this.$nextTick(() => {
                    setTimeout(() => {
                        this.$emit('toggleChange', this.hide);
                    }, 600);
                });
            }
        },
        computed: {
            getTitlePos: function() {
                return this.titleLeft ? 'txt-left' : '';
            }
        },
        mounted() {
            //console.log(this.titleLeft);
        }
    }
</script>
 
<style scoped>
    .content-box-container {
        position: relative;
        box-sizing: border-box;
        height: 100%;
    }
    .content-box {
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
        height: 100%;
        border-radius: 8px;
        font-size: 16px;
    }
 
    .content-box.no-border {
        border: none;
    }
 
    .content-box-title {
        margin-top: 4px;
        margin-left: 4px;
        margin-right: 4px;
        padding-left: 10px;
        border-radius: 4px;
        font-size: 20px;
        text-align: center;
        line-height: 36px;
        font-weight: bold;
    }
 
    .content-box-title.txt-left {
        text-align: left;
    }
 
    .content-box-content {
        position: relative;
        flex: 1;
        margin-top: 4px;
        /* margin-left: 4px;
        margin-right: 4px; */
        overflow-y: auto;
    }
 
    .footer .content-box-content {
        bottom: 32px;
    }
 
    .content-box-footer {
        margin-left: 4px;
        margin-right: 4px;
        padding-left: 10px;
        border-radius: 6px;
        font-size: 14px;
        text-align: center;
        line-height: 32px;
        font-weight: bold;
    }
 
    .toggle-flag {
        position: absolute;
        font-size: 20px;
        width: 20px;
        line-height: 40px;
        right: 1px;
        top: 50%;
        margin-top: -20px;
        z-index: 99;
        background-color: #000000;
        border-top-left-radius: 8px;
        border-bottom-left-radius: 8px;
    }
 
    .toggle-flag:hover {
        cursor: pointer;
        background-color: #252424;
    }
 
    .content-box-container .toggle-flag {
        transition: 0.5s ease;
    }
 
    .content-box-hide .toggle-flag {
        right: -21px;
        transform: rotate(180deg);
        transition: 0.5s ease;
    }
 
    .content-box-container {
        transition: 0.5s ease;
    }
 
    .content-box-container.content-box-hide {
        width: 0 !important;
        transition: 0.5s ease;
    }
 
    .box-tools {
        position: absolute;
        top: 4px;
        right: 8px;
        color: #00feff;
    }
  .box-tools-contain {
    display: flex;
    flex-direction: row-reverse;
  }
</style>