element/packages/tabs/src/tab-pane.vue

52 lines
895 B
Vue
Raw Normal View History

<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 = {
name: 'ElTabPane',
2016-07-27 06:15:02 +00:00
props: {
2016-11-18 07:41:08 +00:00
label: String,
labelContent: Function,
name: String,
2016-12-08 02:47:16 +00:00
closable: Boolean,
disabled: Boolean
2016-07-27 06:15:02 +00:00
},
data() {
return {
index: null
2016-07-27 06:15:02 +00:00
};
},
computed: {
isClosable() {
return this.closable || this.$parent.closable;
},
active() {
return this.$parent.currentName === (this.name || this.index);
}
2016-07-27 06:15:02 +00:00
},
created() {
this.$parent.$forceUpdate();
2016-07-27 06:15:02 +00:00
},
2016-09-28 07:20:50 +00:00
destroyed() {
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>