when checked, I want to pass the row data item, and insert the uid in the item into the array selectedId according to the value of the value after the CheckBox update.
there is only one default callback parameter in the official document. I want to pass one more parameter on this basis. Is there anything I can do?
here is my code.
<div id="app">
<div v-for="item in stylesData">
<el-checkbox v-model="item.checked" @change="selecteChange(item)"></el-checkbox>
<img v-bind:src="item.src"/>
{{item.text}}
</div>
</div>
<script>
const app = new Vue({
el: "-sharpapp",
data: function(){
return {
selectedId: [], //UID
stylesData: [{
uid: 1,
checked: false,
src: "xxx.jpg",
text: ""
},{
uid: 2,
checked: false,
src: "xxxx.jpg",
text: ""
},{
uid: 3,
checked: false,
src: "xxxxx.jpg",
text: ""
}]
}
},
methods: {
selecteChange: function(item,value){
console.log(item);
console.log(value);
if(value == true){
app.selectedId.push(item.uid);
}
}
}
});
</script>