forked from ElemeFE/element
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollapse-item.vue
71 lines (61 loc) · 1.42 KB
/
collapse-item.vue
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
<template>
<div class="el-collapse-item" :class="{'is-active': isActive}">
<div class="el-collapse-item__header" @click="handleHeaderClick">
<i class="el-collapse-item__header__arrow el-icon-arrow-right"></i>
<slot name="title">{{title}}</slot>
</div>
<collapse-transition>
<div class="el-collapse-item__wrap" v-show="isActive">
<div class="el-collapse-item__content">
<slot></slot>
</div>
</div>
</collapse-transition>
</div>
</template>
<script>
import Emitter from 'element-ui/src/mixins/emitter';
import CollapseTransition from 'element-ui/src/transitions/collapse-transition';
export default {
name: 'ElCollapseItem',
componentName: 'ElCollapseItem',
mixins: [Emitter],
components: {
CollapseTransition
},
data() {
return {
contentWrapStyle: {
height: 'auto',
display: 'block'
},
contentHeight: 0
};
},
props: {
title: String,
name: {
type: [String, Number],
default() {
return this._uid;
}
}
},
computed: {
isActive() {
return this.$parent.activeNames.indexOf(this.name) > -1;
}
},
watch: {
'isActive'(value) {
}
},
methods: {
handleHeaderClick() {
this.dispatch('ElCollapse', 'item-click', this);
}
},
mounted() {
}
};
</script>