后台返回数据:
saleAttrCode: "[
{
id:'1',
attrValue:'2升',attrName:'瓶装'
},
{
id:'ddd33',
attrValue:'白色',attrName:'颜色'
}
]"
将此数据转换为正常数组对象格式:
(2) [{…}, {…}]
0: {id: "1", attrValue: "2升", attrName: "瓶装"}
1: {id: "ddd33", attrValue: "白色", attrName: "颜色"}
length: 2
__proto__: Array(0)
方法:
console.log(eval('(' + q.saleAttrCode + ')'));