【发布时间】:2018-08-24 06:37:54
【问题描述】:
对象的 JSON
{
"ProductId": 20,
"ProductName": "LCD",
"ProductDescription": "Sony",
"BuyingPrice": "15000 ",
"VendorId": 46,
"CategoryId": 25,
"CreatedBy": 0,
"UpdateBy": null,
"IsActive": true,
"IsDeleted": false,
"CreatedDate": "2018-03-14",
"UpdatedDate": null,
"WareHouseProducts": [
{
"WareHouseProductsId": 11,
"TotalQuantity": 15,
"AvailableQuantity": 8,
"ProductId": 20,
"WareHouseId": 4,
"CreatedBy": null,
"UpdateBy": null,
"IsActive": true,
"IsDeleted": false,
"CreatedDate": "2018-03-14",
"UpdatedDate": "2018-03-15",
"WarehouseName": "Warehouse 1"
}
]
}
我想减去 AvailableQuantity 或更改事件..
this.products.find(p => p.ProductId == this.selectedProduct)
.WareHouseProducts.find(w => w.AvailableQuantity == this.selectedProduct)
.AvailableQuantity - this.quantity;
我试过了,但没用
我需要减去仓库产品可用数量请帮帮我..
【问题讨论】:
-
this.selectedProduct 是什么我想你必须选择其中的值来匹配
-
this.selectedProduct 是下拉列表.. this.quantity 是输入数字... 用户可以在单击添加按钮时选择产品添加数量,例如 5 或 6... 我想减去可用数量跨度>
-
请发布一个例子!
-
请发布您的下拉列表以及您如何获得用户选择的价值
标签: javascript arrays angularjs typescript