2021-03-25 22:33:41 +08:00
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
class="tab-pane fade"
|
|
|
|
:id="tabID"
|
|
|
|
role="tabpanel"
|
|
|
|
:aria-labelledby="labelID"
|
|
|
|
>
|
|
|
|
<slot />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-04-06 23:47:32 +08:00
|
|
|
import { defineComponent } from "vue";
|
2021-03-25 22:33:41 +08:00
|
|
|
|
2021-04-06 23:47:32 +08:00
|
|
|
export default defineComponent({
|
2021-03-25 22:33:41 +08:00
|
|
|
props: {
|
|
|
|
title: {
|
2021-04-04 14:38:46 +08:00
|
|
|
type: String,
|
|
|
|
},
|
2021-03-25 22:33:41 +08:00
|
|
|
},
|
|
|
|
data() {
|
2021-05-24 23:33:27 +08:00
|
|
|
let tag = this.title;
|
2021-03-25 22:33:41 +08:00
|
|
|
return {
|
2021-05-24 23:33:27 +08:00
|
|
|
tabID: tag,
|
2021-03-25 22:33:41 +08:00
|
|
|
};
|
|
|
|
},
|
2021-05-28 22:11:48 +08:00
|
|
|
mounted() {
|
|
|
|
this.tabID = "tab-" + Math.random().toString(36).substring(2);
|
|
|
|
this.$parent.$data.children.push({ id: this.tabID, title: this.title });
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
labelID(): String {
|
|
|
|
return this.tabID + "-label";
|
|
|
|
},
|
2021-04-04 14:38:46 +08:00
|
|
|
},
|
2021-03-25 22:33:41 +08:00
|
|
|
});
|
|
|
|
</script>
|
2021-04-06 23:47:32 +08:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-05-03 12:57:54 +08:00
|
|
|
@import "node_modules/bootstrap/scss/bootstrap";
|
2021-04-06 23:47:32 +08:00
|
|
|
</style>
|