2020-07-26 12:16:29 +00:00
|
|
|
<template>
|
|
|
|
<li
|
|
|
|
:class="{
|
|
|
|
'tabs-title': true,
|
|
|
|
'is-active': active,
|
|
|
|
}"
|
|
|
|
>
|
|
|
|
<a @click="onTabClick">
|
|
|
|
{{ name }}
|
|
|
|
<span v-if="showBadge" class="badge">
|
|
|
|
{{ getItemCount }}
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
</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,
|
|
|
|
},
|
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
|
|
|
},
|
|
|
|
},
|
|
|
|
|
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>
|