You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1014 B
53 lines
1014 B
|
6 years ago
|
<template>
|
||
|
|
<el-card :class="{collapsed}">
|
||
|
|
<div slot="header" class="clearfix">
|
||
|
6 years ago
|
<slot name="header">{{ header }}</slot>
|
||
|
6 years ago
|
<i class="el-icon-arrow-up form-card-icon"/>
|
||
|
6 years ago
|
</div>
|
||
|
|
<slot/>
|
||
|
|
</el-card>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script>
|
||
|
6 years ago
|
export default {
|
||
|
6 years ago
|
name: "FormCard",
|
||
|
6 years ago
|
|
||
|
6 years ago
|
props: {
|
||
|
|
header: String
|
||
|
|
},
|
||
|
6 years ago
|
|
||
|
6 years ago
|
data: () => ({collapsed: false}),
|
||
|
6 years ago
|
|
||
|
6 years ago
|
methods: {
|
||
|
|
collapse() {
|
||
|
|
this.collapsed = !this.collapsed
|
||
|
6 years ago
|
}
|
||
|
6 years ago
|
},
|
||
|
|
|
||
|
|
mounted() {
|
||
|
|
const dom = this.$el.querySelector('.el-card__header')
|
||
|
|
dom.addEventListener('click', this.collapse)
|
||
|
|
this.$once('hook:beforeDestroy', () => {
|
||
|
|
dom.removeEventListener('click', this.collapse)
|
||
|
|
})
|
||
|
6 years ago
|
}
|
||
|
6 years ago
|
}
|
||
|
6 years ago
|
</script>
|
||
|
|
|
||
|
|
<style>
|
||
|
6 years ago
|
.form-card-icon {
|
||
|
6 years ago
|
float: right;
|
||
|
|
font-weight: bold;
|
||
|
|
transition: transform .3s;
|
||
|
|
cursor: pointer;
|
||
|
|
}
|
||
|
6 years ago
|
|
||
|
6 years ago
|
.collapsed .form-card-icon {
|
||
|
6 years ago
|
transform: rotate(180deg);
|
||
|
|
}
|
||
|
6 years ago
|
|
||
|
6 years ago
|
.el-card.collapsed > .el-card__body {
|
||
|
|
display: none;
|
||
|
|
}
|
||
|
6 years ago
|
</style>
|