與此相同的情況如何顯示 openweathermap 天氣圖示
為什么我無法使用此代碼獲取圖示的 ID?
const value = weather.weather
console.log('icon', value)
console.log('icon', value[0].icon)
const url = `http://openweathermap.org/img/${value[0].icon}.png`
return(
<div>
<div> temperature {weather?.main?.temp} Celcius</div>
<img src='url' alt="icon" width="120" height="100"></img>
<p>wind {weather?.wind?.speed} m/s</p>
</div>
)
uj5u.com熱心網友回復:
檢查:
const url = `http://openweathermap.org/img/${value?.[0].icon}.png`
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/428953.html
