API价格显示“未定义”

问题描述

需要帮助, 当我执行此功能时,得到“未定义”

async function getPrice() {
  fetch('https://api.coingecko.com/api/v3/simple/price?ids=yfii-finance&vs_currencies=usd')
    .then((response) => {
      return response.json();
    })
    .then((data) => {
      console.log(data.yfii-finance.usd);
      getROI(data.yfii-finance.usd);
    })
    .catch((error) => {
      error("something went wrong with fetch!");
    })
}

但是当我换成以太坊时,价格就显示出来了

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)