non-professional students seek answers from the Party
haven"t studied web design
but to complete a final project, you need to use a web page
ask for teaching
what I want to achieve is that when jiaClick function is executed, I can add an original data to the original rbars form, which is similar to the shopping cart form
Thank you
var vue = new Vue({
el: "-sharpfl",
data: {
rbars: [
{
img: "1.png",
title: "1",
spec: "",
status: [],
price: "1",
orig: "",
stock: 10000,
count: 0
},
{
img: "2.png",
title: "2",
spec: "",
status: [],
price: "2",
orig: "",
stock: 10000,
count: 0
},
{
img: "3.png",
title: "3",
spec: "",
status: [],
price: "3",
orig: "",
stock: 10000,
count: 0
},
],
},
methods: {
jiaClick: function(e) {
var that = this;
var idx = parseInt(e.target.dataset.idx);
var list = that.rbars;
var count = parseInt(list[idx].count);
if(count < 0) {
count = 1;
} else {
list[idx].count = count + 1;
}
that.rbars = list;
this.rbars.push()
},
}
})
for example, if there are three sets of data, when I jiaClick function the second group of data, I will add the second group of data once. How to write