mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 11:37:58 +00:00
Fixes https://github.com/chatwoot/chatwoot/issues/8436 Fixes https://github.com/chatwoot/chatwoot/issues/9767 Fixes https://github.com/chatwoot/chatwoot/issues/10156 Fixes https://github.com/chatwoot/chatwoot/issues/6031 Fixes https://github.com/chatwoot/chatwoot/issues/5696 Fixes https://github.com/chatwoot/chatwoot/issues/9250 Fixes https://github.com/chatwoot/chatwoot/issues/9762 --------- Co-authored-by: Pranav <pranavrajs@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
58 lines
1004 B
Vue
58 lines
1004 B
Vue
<script setup>
|
|
import { computed, inject } from 'vue';
|
|
|
|
const props = defineProps({
|
|
index: {
|
|
type: Number,
|
|
default: 0,
|
|
},
|
|
name: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
disabled: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
count: {
|
|
type: Number,
|
|
default: 0,
|
|
},
|
|
showBadge: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
});
|
|
|
|
const activeIndex = inject('activeIndex');
|
|
const updateActiveIndex = inject('updateActiveIndex');
|
|
|
|
const active = computed(() => props.index === activeIndex.value);
|
|
const getItemCount = computed(() => props.count);
|
|
|
|
const onTabClick = event => {
|
|
event.preventDefault();
|
|
if (!props.disabled) {
|
|
updateActiveIndex(props.index);
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<li
|
|
class="tabs-title"
|
|
:class="{
|
|
'is-active': active,
|
|
}"
|
|
>
|
|
<a @click="onTabClick">
|
|
{{ name }}
|
|
<div v-if="showBadge" class="badge min-w-[20px]">
|
|
<span>
|
|
{{ getItemCount }}
|
|
</span>
|
|
</div>
|
|
</a>
|
|
</li>
|
|
</template>
|