比如说 const categoryProp = {食品:34,家居生活:23,运动户外:12} 转换成 [{name:食品,value:34},{name:家居生活,value:23},{name:运动户外,value:12}]的形式
const categoryPropXData = Object.keys(categoryProp || {});
const categoryPropYData = Object.values(categoryProp || {});
const newDataArr = [];
categoryPropXData.map((item, index) => {
newDataArr.push({
name: item,
value: categoryPropYData[index],
});
});