Reputation: 39
I am trying to get a value from the lists of array from the api and use a v-if to display in the view page.
For example:
I have the response from api like this upon doing console:
list: [ "user:getAll",.................................................., __ob__: Observer]
Now i want to display some text in a box, i am displaying using like this:
<div>
<div v-if="!list === 'place:list'">
Do not show
</div>
<div v-else>Show</div>
</div>
Issue is v-if is not working i guess as it is not getting the place:list
Please suggest
Upvotes: 0
Views: 28
Reputation: 2037
You're comparing an array to a string. I'm guessing what you mean to do is check if the string 'place:list' is in the list array?
<div>
<div v-if="!list.includes('place:list')">
Do not show
</div>
<div v-else>Show</div>
</div>
Upvotes: 1