[Vuejs]-Changing boolean v-model generated from v-for

0👍

I think this is correct behaviour. In your first case,everytime v-for gets [{ state: true, id: 1 }, { state: true, id: 2 }, { state: false, id: 3 }]. So, checkbox q & 2 will always have state = true and checkbox 3 will always have state=false. Although you change the value of state from witing the checkbox, again, the props sent to checkbox becomes the same as before since, you are providing the new array everytime with v-for.

But, in second case, since, you are providing reactive data from vue, when you change the value, the state gets updated, and your checkbox works. The array of object provided here is same everytime.

I’m not sure if I was able to answer this the best way, but other people might provide you better explanation.

Leave a comment