[Vuejs]-Vuejs v-if and page loading

0👍

The answer lies here,

<span v-if="notificationsCount !== 0" v-bind:class="{ 'pl-2': notificationsCount > 0 }"></span>

But

I might indicate any class or any text has no effect when notificationsCount is 0 because the node is not rendered at all.

0👍

Try to use something like:

<span v-if="notificationsCount !== 0" v-bind:class="{ pl-2: notificationsCount }" class="text-def font-bold" v-text="notificationsCount"></span>

Hope that helps.

0👍

:class=”{ pl-2: notificationsCount<0 }”

👤CF2096

Leave a comment