二維陣列JSON.stringify 後,第二層陣列解析為空

瘋和尚——前端收藏工程師發表於2020-10-09

解決辦法,把陣列內的內容轉為物件

/***解決jsonstr 二維陣列轉為空的問題  fhs 20.10.9*/
	var newreceActDataList=[];
	var oldreceActDataList =receActDataList;
	for(var i = 0 ; i < oldreceActDataList.length; i++){ 
		newreceActDataList[i]={};//物件
		newreceActDataList[i]['upload_id'] = oldreceActDataList[i]['upload_id'];
		newreceActDataList[i]['url'] = oldreceActDataList[i]['url'];
		newreceActDataList[i]['name'] = oldreceActDataList[i]['name'];
	}
receActDataList = newreceActDataList;

相關文章