小程序模板网

查看内容 Demo分析学习《一》天气预报:联系人列表锚点

2018-04-18 渠伊钱

制作者:天下钞票

demo地址:天气预报:联系人列表锚点

 

亮点一、wx:if wx:else的使用来制作城市列表

 

				
  1. <block wx:for="{{cityArray}}">
  2. <block wx:if="{{item.type=='city'}}">
  3. <view class="item" id="{{item.city}}" hover="true" hover-class="scroll-item-hover" bindtap="cityClickEvent">
  4. <text class="city">{{item.city}}</text>
  5. </view>
  6. </block>
  7. <block wx:else>
  8. <view class="index" id="{{item.type}}">
  9. <text class="city">{{item.type}}</text>
  10. </view>
  11. </block>
  12. </block>

配套的城市代码(部分):

 

				
  1. cityArray: [
  2. { "type": "A" },
  3. { "city": "阿坝", "city_en": "Aba", "type": "city" },
  4. { "city": "阿克苏", "city_en": "Akesu", "type": "city" },
  5. { "city": "阿拉尔", "city_en": "Alaer", "type": "city" },
  6. { "city": "阿勒泰",


易优小程序(企业版)+灵活api+前后代码开源 码云仓库:starfork
本文地址:https://www.eyoucms.com/wxmini/doc/course/23593.html 复制链接 如需定制请联系易优客服咨询:800182392 点击咨询
QQ在线咨询