| | |
| | | <template> |
| | | <div class="content-box" :class="{'no-border': noborder}"> |
| | | <div class="content-box-title" :class="getTitlePos" v-if="!noHeader"> |
| | | <slot name="title">{{title}}</slot> |
| | | <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-content"> |
| | | <slot></slot> |
| | | </div> |
| | | <div class="content-box-footer"> |
| | | <slot name="footer"></slot> |
| | | <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> |
| | | </template> |
| | |
| | | noHeader: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | toggle: { |
| | | type: Boolean, |
| | | default: false |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | hide: false |
| | | } |
| | | }, |
| | | methods: { |
| | | toggleChange() { |
| | | console.log(this.hide); |
| | | this.hide = this.hide?false:true; |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .content-box-container { |
| | | position: relative; |
| | | box-sizing: border-box; |
| | | height: 100%; |
| | | } |
| | | .content-box { |
| | | display: flex; |
| | | flex-direction: column; |
| | |
| | | text-align: left; |
| | | } |
| | | .content-box-content { |
| | | position: relative; |
| | | flex: 1; |
| | | margin-top: 4px; |
| | | margin-left: 4px; |
| | |
| | | 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: 9999; |
| | | 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; |
| | | } |
| | | </style> |
| | | |
| | | |