<v-card :style="{ textAlign: 'left' }" class="basic-card pa-6"
:class="{ 'small-padding': !$vuetify.breakpoint.xl }"
elevation="0" flat :height="windowHeight - 104 + 'px'" outlined align="start" justify="start">
<v-row class="mt-0">
<v-col cols="12" class="pt-0">
<v-tabs v-model="eventTabs" center-active class="mx-0" grow>
<v-tab v-for="(tab, index) in eventAssets" :key="index"
:class="{ 'mr-1': index < (eventAssets.length - 1) }" class="pa-0 text-none">
<v-badge v-if="tab == 'Tasks' && uncompletedTasksNumber > 0" color="error"
:content="uncompletedTasksNumber" tile>
{{ tab }}
</v-badge>
<div v-else>
{{ tab }}
</div>
</v-tab>
</v-tabs>
</v-col>
</v-row>
</v-card>
I tried a few changes but had no result, whole time if You want to see the counter(v-badge), You need to click on the button "Tasks" which is not what I want. We want to see it without any action.
Before clicking, when we want to see that counter:
When I click on the button "Tasks"
3
Answers
To make the counter badge visible at all times without requiring a click, you can remove the v-badge component and use a simple span element with a class that applies the styling you want. Try this:
We use a span element with a class badge to add a red background colour, a border around the text, and another class badge counter to apply styling to the counter number. The counter is displayed inside a span element with the {{ uncompletedTasksNumber }} expression, which will display the actual number of uncompleted tasks.
This is the answer you looking for? just add the uncompletednumber of task into the array when loop use v-if to do checking.
Example Sandbox
Your example should work as is, only two tiny modifications are needed. First, put
{{ tab }}
outside ofv-badge
because it is not part ofv-badge
. Second, use inline prop which will move the badge to inline with the wrapping element, i.e tab element.Here is a demo-