mardi 3 septembre 2019

How can I use if statement with v-for?

I wanna rendering inner matrix in cell matrix by input value. But only render to selected element.

this is my codepen. https://codepen.io/ofleaf/pen/EJgoVp

I think should modify below code.

<div class="inner-layout"
       v-for="val in calInnerLayout"
       :style="{ width: calInnerLayoutWidth + '%', height: calInnerLayoutHeight + '%' }"></div>

How can I use if statement with v-for? I would like to compare the parent element of the current inner element with the active element and then update that inner element if it matches, otherwise keep the existing value.




Aucun commentaire:

Enregistrer un commentaire