0👍
everything that is passed to a v-if directive gets evaluated as a javascript expression, so whatever you pass to it should be valid a javascript expression.
In your case, if you do:
v-if="'seen['+bike.owner.id+']'"
This will be evaluated as a string 'seen[2]'
which is basically a truthy value (a non empty string)
What you need to do in your case is:
v-if="seen[bike.owner.id]"
Which will pass to the v-if the actual value stored in the seen array at the position determined by bike.owner.id
Thanks,
0👍
The initialisation of the map in created I simply had as
this.seen = false;
I changed this to
Vue.set(this.seen, i, false);
and now it works.
Source:stackexchange.com