c就是我需要的数据,我在外面用了country兜着
country.push(c) 改为 country = c
country[0]
可以用async/await
,示例如下:
const getCountry = async () => {
const res = await fetch("url", {
method: "POST",
headers: {
"Content-Type": "application/json;charset=utf-8",
},
});
const { code, msg, data } = await res.json();
console.log("data", data);
};
getCountry();