【发布时间】:2020-07-13 05:06:39
【问题描述】:
我的目标是创建一个包含许多图像的表格。通过这样做,我将通过一个具有该图像位置的数组。我的问题是,如何将此字符串转换为动态字符串:
<td><img src="http://openweathermap.org/img/w/ + local.weather[0].icon +.png"></td>
“local.weather[0].icon”是动态部分。我似乎无法找到一种可行的方法。
【问题讨论】:
-
试试
src="http://openweathermap.org/img/w/" + local.weather[0].icon + ".png" -
@AneesIjaz 我之前试过,但由于某种原因,“.png”部分没有变成字符串
-
我猜你将不得不使用 js。
-
@AneesIjaz 我遇到了同样的错误。 “.png”部分变成白色并且不会变成字符串。我应该把“”放在哪里?还是我应该使用 ' ' ?