【发布时间】:2019-09-23 08:39:49
【问题描述】:
在这样的api返回值中,
[
"Action",
"Comedy",
"Documentary",
"Drama"
]
我需要像这样修改上面的数组,
const techCompanies = [
{ label: "Action", value: 1 },
{ label: "Comedy", value: 2 },
{ label: "Documentary", value: 3 },
{ label: "Drama", value: 4 }
];
我用axios获取数据,
const response = await axios.get("http://localhost:3000/Movie/v1.0/genre");
【问题讨论】:
-
你是如何获得财产
value的? -
可能是数组索引