2020-07-26 12:16:29 +00:00
|
|
|
<template>
|
|
|
|
<li
|
|
|
|
:class="{
|
|
|
|
'tabs-title': true,
|
|
|
|
'is-active': active,
|
2021-12-03 15:16:49 +00:00
|
|
|
[variant]: variant,
|
2020-07-26 12:16:29 +00:00
|
|
|
}"
|
|
|
|
>
|
2021-12-03 15:16:49 +00:00
|
|
|
<woot-button
|
|
|
|
:size="size"
|
|
|
|
:variant="buttonVariant"
|
|
|
|
:color-scheme="colorScheme"
|
|
|
|
:is-rounded="isRounded"
|
|
|
|
@click="onTabClick"
|
|
|
|
>
|
2020-07-26 12:16:29 +00:00
|
|
|
{{ name }}
|
|
|
|
<span v-if="showBadge" class="badge">
|
|
|
|
{{ getItemCount }}
|
|
|
|
</span>
|
2021-12-03 15:16:49 +00:00
|
|
|
</woot-button>
|
2020-07-26 12:16:29 +00:00
|
|
|
</li>
|
|
|
|
</template>
|
|
|
|
<script>
|
2019-08-14 09:48:44 +00:00
|
|
|
export default {
|
|
|
|
name: 'WootTabsItem',
|
|
|
|
props: {
|
|
|
|
index: {
|
|
|
|
type: Number,
|
|
|
|
default: 0,
|
|
|
|
},
|
|
|
|
name: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
disabled: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
count: {
|
|
|
|
type: Number,
|
|
|
|
default: 0,
|
|
|
|
},
|
2020-07-26 12:16:29 +00:00
|
|
|
showBadge: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
2021-12-03 15:16:49 +00:00
|
|
|
variant: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
// Available variants: [ '', 'smooth']
|
|
|
|
},
|
|
|
|
size: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
active() {
|
|
|
|
return this.index === this.$parent.index;
|
|
|
|
},
|
|
|
|
|
|
|
|
getItemCount() {
|
2021-12-21 02:19:59 +00:00
|
|
|
return this.count;
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
2021-12-03 15:16:49 +00:00
|
|
|
colorScheme() {
|
|
|
|
if (this.variant === 'smooth') return 'secondary';
|
|
|
|
return this.active ? '' : 'secondary';
|
|
|
|
},
|
|
|
|
buttonVariant() {
|
|
|
|
if (this.variant === 'smooth') return this.active ? 'smooth' : 'clear';
|
|
|
|
return 'clear';
|
|
|
|
},
|
|
|
|
isRounded() {
|
|
|
|
return this.variant === 'smooth';
|
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
|
|
|
|
2020-07-26 12:16:29 +00:00
|
|
|
methods: {
|
|
|
|
onTabClick(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
if (!this.disabled) {
|
|
|
|
this.$parent.$emit('change', this.index);
|
|
|
|
}
|
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
|
|
|
};
|
2020-07-26 12:16:29 +00:00
|
|
|
</script>
|