function formatPrice(list,field,price) {
list.forEach(item => {
item[field] = price//实际处理的代码
if (item.children) {
if (item.children.length === 0) {
delete item.children;
} else if (item.children.length > 0) {
formatPrice(item.children,field,price);
}
}
});
return data;
}