feat: tab component readonly

This commit is contained in:
puriphatt 2024-06-06 10:29:30 +00:00
parent da2c6115b4
commit 04dac12a24

View file

@ -2,6 +2,10 @@
import { ref } from 'vue'; import { ref } from 'vue';
import { CustomerBranchCreate } from 'stores/customer/types'; import { CustomerBranchCreate } from 'stores/customer/types';
defineProps<{
readonly?: boolean;
}>();
const customerBranch = defineModel<CustomerBranchCreate[]>('customerBranch', { const customerBranch = defineModel<CustomerBranchCreate[]>('customerBranch', {
default: [], default: [],
}); });
@ -67,6 +71,7 @@ function close(index: number) {
style="background-color: var(--_body-bg)" style="background-color: var(--_body-bg)"
@click="addData()" @click="addData()"
icon="mdi-plus" icon="mdi-plus"
:disable="readonly"
></q-btn> ></q-btn>
<q-tabs <q-tabs
active-bg-color="white" active-bg-color="white"
@ -97,11 +102,12 @@ function close(index: number) {
color="red" color="red"
:class="{ dark: $q.dark.isActive }" :class="{ dark: $q.dark.isActive }"
@click.stop="close(index)" @click.stop="close(index)"
v-if="!readonly"
/> />
</q-tab> </q-tab>
</q-tabs> </q-tabs>
</div> </div>
<div class="column"> <div class="column seprarator-fix">
<q-tab-panels v-model="tab" class="rounded-borders"> <q-tab-panels v-model="tab" class="rounded-borders">
<q-tab-panel <q-tab-panel
v-for="(v, index) in customerBranch" v-for="(v, index) in customerBranch"
@ -119,7 +125,7 @@ function close(index: number) {
</div> </div>
</template> </template>
<style scoped> <style scoped lang="scss">
.active-tab { .active-tab {
border: 1px solid #e0dcdc; border: 1px solid #e0dcdc;
border-bottom: none; border-bottom: none;
@ -132,4 +138,8 @@ function close(index: number) {
border-left: none; border-left: none;
border-top: none; border-top: none;
} }
:deep(.q-separator) {
padding-block: 0px !important;
}
</style> </style>