2

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 Answer 1

2

You can do this as follows:

<p class="user" v-if="Item && Item.date"><i class="fa fa-user"></i>{{Item.date }}</p>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.