commonUseUrlGetMethod() {
return new Promise((resolve, reject) => {
this.$api.commonPostApi(this.url,this.reqParams).then(res => { if (res) { resolve(res.data); } })
.catch(err => {reject(err); })
})
}
// arry.map 返回obj里面指定的属性
example:
var arr = [{a: 1,b:2}, {a: 333, b: 444}];
var dealArr = arr.map(item => {return item.a}) // 打印结果 ([1,333]);
// 循环往数组中插入对象时要确保每次都创建一个新的对象
res.forEach((item, index) => {
let itemObj = {};
itemObj['name'] = item.configuration_name;
itemObj['value'] = item.person_count;
seriesDataArr.push(itemObj);
})
网友评论