Hide div if value null in vue.js laravel

Viewed 980

I want to hide div if value of a variable is null or empty, i'm using following code but if the value is empty or NULL it is still showing the same div using vue.js.

 <p class="user" v-show="Item.date !== 'NULL'"><i class="fa fa-user"></i>{{Item.date }}</p>

Here i'm checking Item.date whether it is null or not.

1 Answers

You can do this as follows:

<p class="user" v-if="Item && Item.date"><i class="fa fa-user"></i>{{Item.date }}</p>
Related