[Vuejs]-Vue: How to check multiple string in v-show

1👍

That attribute value isn’t a valid javascript expression.

You could modify it to:

v-show="form.status === 'vh' || form.status === 'pr' || form.status === 'o'"

for a quick win, or if you don’t like attribute clutter, write a computed/getter for this expression in your script.

3👍

You can use an array instead with includes/indexOf > -1 (depending on your build setup / browser support) to avoid some repetition

v-show="['vh', 'pr', 'o'].includes(form.status)"

Leave a comment