SOURCE

let list = [
    {type:'网络',name:'1'},
    {type:'网络',name:'1'},
    {type:'硬件',name:'1'},
    {type:'电脑',name:'1'},
    {type:'手机',name:'1'},
    {type:'手机',name:'1'},
    {type:'手机',name:'1'},
    {type:'手机',name:'1'}
];
let groups = {}
list.forEach(item=>{
    groups[item.type] = groups[item.type]||[];
    groups[item.type].push(item);
})
console.log(groups)
let arr = [];
Object.keys(groups).map(item=>{
    arr.push({
        type:item,
        children:groups[item],
        percent:(groups[item].length/list.length)*100 +'%'
    })
})
console.log(arr)
console 命令行工具 X clear

                    
>
console