[Vuejs]-Show select by value with Vue

0👍

You can use Vue’s template conditionals:

  <template v-if='["vat", "international_contract"].map(val => !hiring_types.map(entry => entry.value).includes(val)).every(v => v)'>
  <!-- insert b-form-group -->
  </template>

Better to make this conditional a computed property and use it in your template for brevity:

// in your script
{
computed: {
  showFormGroup () {
     return ["vat", "international_contract"]
       .map(val => !hiring_types.map(entry => entry.value)includes(val))
       .every(v => v)
  }
}

// in your template
<template v-if='showFormGroup'> ... </template>

Leave a comment