data: () => ({
mainCategories: [
{ merchantId: '1', checked: true },
{ merchantId: '2', checked: true },
...
],
}),
computed: {
checkedCategories() {
return this.mainCategories.filter(n => n.checked).map(n => n.merchantId);
},
},
<li v-for="n in mainCategories">
<label>
<input type="checkbox" v-model="n.checked">
{{ n.merchantId }}
</label>
</li>
created() {
this.checkedCategories = this.mainCategories.map(n => n.merchantId);
},