I have button who do functin
Function:
methods: {
addToCard(object) {
object = this.objects[isAdded];
if (!object == false) {
console.log("isAdded");
object.isAdded = true;
} else {
console.log("is not Added");
object.isAdded = false;
}
}
}
};
And data objects:
data() {
return {
objects: [
{ text: "test", price: 50, ImgUrl: "/images.png", isAdded: false },
{ text: "test2", price: 60, ImgUrl: "/images.png", isAdded: false },
{ text: "test3", price: 70, ImgUrl: "/images.png", isAdded: false },
{ text: "test4", price: 80, ImgUrl: "/images.png", isAdded: false },
{ text: "test5", price: 90, ImgUrl: "/images.png", isAdded: false },
],
};
},
when I click on the button <Button @click="addToCard(object)">add</Button>
I have a Error in console
Uncaught TypeError: _ctx.addToCard is not a function
NuxtJS 4
0
callWithErrorHandling
callWithAsyncErrorHandling
invoker
I did read MDN web docs but I don’t find what I need