2016-12-21 16:02:51 +00:00
|
|
|
<template>
|
|
|
|
<div class="el-tab-pane">
|
|
|
|
<div class="el-tab-pane__content" v-show="active">
|
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
2016-07-27 06:15:02 +00:00
|
|
|
<script>
|
|
|
|
module.exports = {
|
2016-12-31 15:33:51 +00:00
|
|
|
name: 'ElTabPane',
|
2016-07-27 06:15:02 +00:00
|
|
|
|
|
|
|
props: {
|
2016-11-18 07:41:08 +00:00
|
|
|
label: String,
|
|
|
|
labelContent: Function,
|
2016-11-23 02:47:12 +00:00
|
|
|
name: String,
|
2016-12-08 02:47:16 +00:00
|
|
|
closable: Boolean,
|
|
|
|
disabled: Boolean
|
2016-07-27 06:15:02 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2016-12-21 16:02:51 +00:00
|
|
|
index: null
|
2016-07-27 06:15:02 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2016-12-21 16:02:51 +00:00
|
|
|
computed: {
|
|
|
|
isClosable() {
|
|
|
|
return this.closable || this.$parent.closable;
|
|
|
|
},
|
|
|
|
active() {
|
|
|
|
return this.$parent.currentName === (this.name || this.index);
|
2016-11-23 02:47:12 +00:00
|
|
|
}
|
2016-07-27 06:15:02 +00:00
|
|
|
},
|
|
|
|
|
2016-12-21 16:02:51 +00:00
|
|
|
created() {
|
|
|
|
this.$parent.$forceUpdate();
|
2016-07-27 06:15:02 +00:00
|
|
|
},
|
|
|
|
|
2016-09-28 07:20:50 +00:00
|
|
|
destroyed() {
|
2016-11-23 02:47:12 +00:00
|
|
|
if (this.$el && this.$el.parentNode) {
|
2016-11-08 16:01:56 +00:00
|
|
|
this.$el.parentNode.removeChild(this.$el);
|
2016-11-04 09:07:49 +00:00
|
|
|
}
|
2016-09-28 07:20:50 +00:00
|
|
|
},
|
|
|
|
|
2016-07-27 06:15:02 +00:00
|
|
|
watch: {
|
2016-12-14 17:53:31 +00:00
|
|
|
label() {
|
|
|
|
this.$parent.$forceUpdate();
|
2016-07-27 06:15:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|