I wrote a js fiddle where I am trying to uncheck the last checkbox checked if more than 3 checkboxes have been checked. I tried setting the index to false, but that didn't work. I also tried pop, also didn't work.
Here is my code https://jsfiddle.net/aaronmk2/ums2jq1g/18/
new Vue({
el: "#app",
data: {
counter: 0,
temp: [],
todos: [
{ text: "Learn JavaScript" },
{ text: "Learn Vue"},
{ text: "Play around in JSFiddle" },
{ text: "Build something awesome" }
]
},
methods: {
toggle: function(todo){
console.log(todo)
todo.done = !todo.done
},
test:function(index){
this.counter++;
if(this.counter > 2){
console.log("reset checkMar")
this.temp[index] = false
}
},
}
})
Aucun commentaire:
Enregistrer un commentaire