获取请求期间货币符号错误

问题描述

你好,我正在使用 CoinGecko 的 API 构建应用程序,在选择欧元符号货币后,我仍然在浏览器中显示美元符号,有人可以帮我解决这些问题吗?

//函数应用(){ const [coins,setCoins] = useState([]);

const [search,setSearch] = useState("");

useEffect(() => {
    axios
        .get(
            "https://api.coingecko.com/api/v3/coins/markets?vs_currency=eur&order=market_cap_desc&per_page=10&page=1&sparkline=false"
        )
        .then((res) => {
            setCoins(res.data);
        })
        .catch((error) => alert("You have some error"));
},[]);

const handleChange = (e) => {
    setSearch(e.target.value);
};

const filteredCoins = coins.filter((coin) =>
    coin.name.toLowerCase().includes(search.toLowerCase())
);

return (
    <div className="coin-app">
        <div className="coin-search">
            <h1 className="coin-text">Search a currency</h1>
            <form>
                <input
                    type="text"
                    placeholder="Search"
                    className="coin-input"
                    onChange={handleChange}
                ></input>
            </form>
        </div>
        <div className="description">
            <h1>Currency: Tag: Price: Volume: Market Cap:</h1>
        </div>
        {filteredCoins.map((coin) => {
            return (
                <Coin
                    key={coin.id}
                    name={coin.name}
                    image={coin.image}
                    symbol={coin.symbol}
                    volume={coin.total_volume}
                    price={coin.current_price}
                    priceChange={coin.price_change_percentage_24h}
                    marketcap={coin.market_cap}
                />
            );
        })}
    </div>
);

}

导出认应用;//

解决方法

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

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

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