debian-mirror-gitlab/app/assets/javascripts/vue_shared/components/tabs/tab.vue

48 lines
712 B
Vue
Raw Normal View History

2018-11-08 19:23:39 +05:30
<script>
export default {
props: {
title: {
type: String,
required: false,
default: '',
},
active: {
type: Boolean,
required: false,
default: false,
},
},
data() {
return {
// props can't be updated, so we map it to data where we can
localActive: this.active,
};
},
watch: {
active() {
this.localActive = this.active;
},
},
created() {
this.isTab = true;
},
updated() {
if (this.$parent) {
this.$parent.$forceUpdate();
}
},
};
</script>
<template>
<div
:class="{
2018-12-23 12:14:25 +05:30
active: localActive,
2018-11-08 19:23:39 +05:30
}"
class="tab-pane"
role="tabpanel"
>
<slot></slot>
</div>
</template>