vue.js|vue数据push后不能响应式更新

1、未新属性先开辟空间

if (res.data.length > 0) { // var goodesMap = new Map() var temp_goodsList = []var trandeProductList = res.data navItem.orderList.push({ goodsList: [] }) for (var i = 0; i < navItem.orderList.length; i++) { for (var j = 0; j < trandeProductList.length; j++) { if (navItem.orderList[i].tradeNo == trandeProductList[j].trandeForm .tradeNo) { temp_goodsList.push(trandeProductList[j]) } } navItem.orderList[i]["goodsList"] = temp_goodsList// Object.assign(navItem.orderList[i], goodesMap.get("goodsList")); // navItem.orderList[i].push(goodsList) temp_goodsList = [] // goodesMap.clear() }// var s = that.navList[0].orderList[0].goodsList.length // for (var i = 0; i < navItem.orderList.length; i++) // { //for (var j = 0; j < navItem.orderList[i].goodsList.length; j++) { //console.log(navItem.orderList[i].goodsList[j].product.name) //}// } }

【vue.js|vue数据push后不能响应式更新】

    推荐阅读