[Vuejs]-The best way of Two-way data binding using vuex in a list

0👍

I have the main list in the whole of programs with contains such items:

{id:1,text:'a',checked:false}

this scenario :

the Search component shows pure of list items either checked or not checked.
the Side Component shows the items checked properly and then click the close button it should disappear and uncheck items simultaneously.

so Search Component bind to the list by :

<input type="checkbox" :value="item.checked" v-model="$store.state.sideBarItems[index].checked">

so my answer is [index].checked which make a proper two-way data binding.

tnx to this post which gives me an idea

Leave a comment