最近做天气的小程序,要根据字段等于 晴 阴 小雨 大雨等显示不同图标,请问怎么条件判断
<text wx:if="{{after_tomorrow_cond_txt_d == "阴"}}" class="iconfont icon-dayu"></text> ... ...
做一个字典表
const dict = [ {key: "sun", title: "晴", path: "./sun.png"} ] fotmatWeather(key){ return dict.filter( item => item.key === key ); }
大约这样吧,有字典总是比较方便的
1.4m articles
1.4m replys
5 comments
56.7k users