feat: tab branch

This commit is contained in:
Net 2024-04-23 11:37:27 +07:00
parent 7bf6001be8
commit 367d2518cf
2 changed files with 62 additions and 0 deletions

View file

@ -0,0 +1,57 @@
<script setup lang="ts">
import { ref } from 'vue';
import AppBox from './app/AppBox.vue';
const tab = ref<string>('');
const index = ref<number>(0);
const tabList = ref<{ name: string; label: string }[]>([]);
function test() {
index.value++;
tabList.value.push({
name: `สาขาที่ ${index.value}`,
label: `สาขาที่ ${index.value}`,
});
tab.value = tabList.value[tabList.value.length - 1].name;
}
</script>
<template>
<div class="column">
<q-tabs
active-bg-color="white"
active-color="primary"
indicator-color="white"
v-model="tab"
align="left"
inline-label
class="bg-primary text-white"
style="width: 960px"
>
<q-tab icon="mdi-plus" @click="test()" />
<q-tab
v-for="v in tabList"
:key="v.name"
:name="v.name"
:label="v.label"
/>
</q-tabs>
</div>
<div class="column">
<q-tab-panels v-model="tab" class="rounded-borders">
<q-tab-panel v-for="v in tabList" :key="v.name" :name="v.name">
<slot name="about"></slot>
<slot name="address"></slot>
<slot name="businessInformation"></slot>
<slot name="contactInformation"></slot>
<slot name="otherDocuments"></slot>
</q-tab-panel>
</q-tab-panels>
</div>
</template>
<style scoped></style>