我使用天气图标动态与天气API。我想图标动态变化,因为我不想有5个以上的选项开关。我在动态创建scss类时遇到了问题。
<i [class]="'wi wi-day-' + '{{weather.daily.weathercode[0] | lowercase}}'"></i>
<i class="wi wi-day-thunderstorm" ></i>
"'wi wi-day-' + '{{weather.daily.weathercode[0] | lowercase}}'"
第2行显示一个雷暴图标,第3行打印“'wi-wi-day-' + 'thunderstorm'”。我不明白为什么1行不行。
1条答案
按热度按时间nafvub8i1#
不要混合使用
[]
和{{}}
符号:或者用途:
或