Skip to content
Advertisement

v-for loop in vue.js

I am trying to iterate the object using v-for.

JavaScript
JavaScript

The above shows all values as the condition is checked within For Loop. Is there a way to iterate and check the object at the beginning.

Advertisement

Answer

I’d use a computed property that returns an array containing…

  1. Only a / Module1 if it exists
  2. The entire exampleObject / checklist.types otherwise

Then you can just iterate that computed property

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement