[Vuejs]-Vue – v-for attaching computed props

0👍

Problem was I was trying to use computed props but this worked where task1Complete() and task2Complete() are regular methods.

tasks: [
        {
          title: 'title1', 
          description: 'task 1 description',
          complete: this.task1Complete()
        },
        {
          title: 'title2',
          description: 'this is another description',
          complete: this.task2Complete()
        } 
      ]
    };

The v-for

  <div
      v-for="(task, index) in tasks"
      :key="index"
      :class="{'is-complete': task.complete}"
    >

Leave a comment