<script>
var obj = { "名字": "张三", "性别": "男" };
const result = Object.keys(obj).map((el) => {
return {
value: el,
label: obj[el]
}
})
console.log(result);
//[{value:"名字",label:"张三"},{value:"姓名",label:"男"}]
</script>
10-26
371
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
01-19
3万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)