字典值转换为数组对象结构

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_41014370/article/details/84533608
let objToList = (obj,code='code',value='value')=>{
    const keys = Object.keys(obj)
    const result = keys.map(it=>{
        return { [code]: it, [value]: obj[it] }
    })
    return result
}

猜你喜欢

转载自blog.csdn.net/weixin_41014370/article/details/84533608