【发布时间】:2019-01-01 11:42:42
【问题描述】:
我正在开发一个电子应用程序,我正在使用 cryptocompare api 来显示 BTC 价格,但它不显示。我已经尝试了所有我能想到的解决方案,我们将不胜感激!
const electron = require('electron');
const path = require('path');
const BrowserWindow = electron.remote.BrowserWindow;
const axios = require('axios');
const notifyBtn = document.querySelector('.notify-btn');
const price = document.querySelector('.price');
const targetPrice = document.querySelector('.target-price');
function getBTC(){
const cryptos = axios.get('https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD&api_key={api_key}')
price.innerHTML = '$'+cryptos
}
getBTC();
setInterval(getBTC, 20000);
它给了我一个'$[object Promise]'的输出
【问题讨论】: