page里面的 starNum 类型写成string了吧,应该是number
wx:forpage中定义starNum = 2; 这样写,只会打印一个图片 <block wx:for="{{starNum}}"> <image src='https://fangmaster-pic.oss-cn-beijing.aliyuncs.com/small_program/grade-star.png' mode="widthFix"></image> </block> <block wx:for="2"> <image src='https://fangmaster-pic.oss-cn-beijing.aliyuncs.com/small_program/grade-star.png' mode="widthFix"></image> </block> 这样写,会打印两个图片 <block wx:for="{{2}}"> <image src='https://fangmaster-pic.oss-cn-beijing.aliyuncs.com/small_program/grade-star.png' mode="widthFix"></image> </block> <block wx:if="{{starNum > 0}}" wx:for="{{[1,2]}}"> <image src='https://fangmaster-pic.oss-cn-beijing.aliyuncs.com/small_program/grade-star.png' mode="widthFix"></image> </block> 这样写,会打印三个图片 <block wx:if="{{starNum > 0}}" wx:for="[1,2]"> <image src='https://fangmaster-pic.oss-cn-beijing.aliyuncs.com/small_program/grade-star.png' mode="widthFix"></image> </block> 为什么会出现这种情况呢?完全搞不懂逻辑 我想实现 <block wx:for="{{starNum}}"> <image src='https://fangmaster-pic.oss-cn-beijing.aliyuncs.com/small_program/grade-star.png' mode="widthFix"></image> </block> 能够打印2个图片,该怎么做?
2018-09-21