Object to Array
objectToArray(obj = {}, title = `标题`){
let datas = [];
if(Object.keys(obj).length) {
datas = [...Object.entries(obj)].map((item, i) => {
return {
key: item[0],
value: item[1],
};
});
}
return {
title,
datas,
};
},
detailTableShaper(json = []){
const {
// productName,
productInfo,
productTypeInfo,
productSortInfo,
productTagInfo,
} = json;
const result = [];
result.push(this.objectToArray(productInfo, "商品信息"));
result.push(this.objectToArray(productTypeInfo, "类型区分"));
result.push(this.objectToArray(productSortInfo, "排序条件"));
result.push(this.objectToArray(productTagInfo, "销售标签"));
return result;
},