【发布时间】:2021-07-24 13:20:54
【问题描述】:
我用https://openweathermap.org/ 开发一个SPA,所以我用
显示img<img src={`http://openweathermap.org/img/w/${data.weather[0].icon}.png`}/>
而不是这个,我想显示我本地文件夹中的另一个图像。我创建了带有 index.js 的 utils 文件夹和另一个名为 weatherIcon 的文件夹,其图标位于 .svg index.js 我有
export const getWeatherIcon = (icon) => (/weatherIcon/${icon}.png)
在我更改的组件中
但在应用中不显示。
问题是:如何显示本地图像而不是Api图像
【问题讨论】:
标签: weather-api