[Vuejs]-How can I select just one item of items to be show in a component after click? in vue js

0👍

This should work (not sure if you need the @click here):

<comandasInd 
  v-if="selectComanda"
  :key= "selectComanda.cid"
  :nombre="selectComanda.nombre">
</comandasInd>                 

<script>
  export default {
    components: { comandasInd },    
    data: () => ({
      comandas: [],
      comanda: {
        nombre: '',
      }
      selectComanda: null,
   }),
   methods: {
     abrirComanda(comanda) {    
         this.selectComanda = comanda;
      }
   }
</script>

Leave a comment