Hide a v-for element with v-show

0

I need to hide an element from v-for with v-show.

I have a list that populates a menu and I need to hide a certain element, can someone give me a light?

    
asked by anonymous 18.12.2017 / 22:57

2 answers

0

Hello, I think it's just you add a boolean with the condition to display the element inside each object link.

<router-link v-for="(link,index) in sidebarLinks" v-show="link.CODICAO_PARA_EXIBIR_ELEMENTO" :to="link.path" tag="li" :ref="link.name" :key="link.name + index">
    <a>
        <i :class="link.icon"></i>
        <p>{{link.name}}</p>
    </a>
</router-link>
    
19.12.2017 / 01:25
0

Hi, unlike the Angular, for example, Vue accepts two directives in the same element:

<button v-for="(letra, indice) in letras" 
    @click="inserirLetra(letra, indice)"
    v-show="botoesRemovidos.indexOf(indice) < 0">
    {{ letra }}
</button>

So it's super simple.

This example I'm showing you, myself that I used in the anagramador project that is part of the book Vue: a practical approach .

I hope I have helped!

    
22.03.2018 / 21:41