<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;
|
|
background-color: #00fefe;
|
color: #153953;
|
}
|
|
.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>
|