【发布时间】:2021-04-09 21:50:42
【问题描述】:
所以我试图用 id_product == 输入的 myproduct 的值填写我的表单。但是当我运行代码时,该值不返回。我的代码有什么问题
this.products.forEach(i => {
if(this.products[i].id == item.id_product)
{
this.form.product_name = this.products[i].product_name;
this.form.id_category = this.products[i].id_category;
this.form.description = this.products[i].description;
this.form.price = this.products[i].price;
this.form.color = this.products[i].color;
this.form.size = this.products[i].size;
this.form.stock = this.products[i].stock;
this.form.weight = this.products[i].weight;
}
});
【问题讨论】:
标签: javascript arrays vue.js for-loop