js文件:wx.getSystemInfo({
success: function (res) {
self.setData({
windowHeight: res.windowHeight + "px",
})
}
})
2.view
列表循環實現:
<view wx:for="{{songList}}" wx:key="songName" class='flex-wrp bc_songList' style="
background-color:{{index%2==0?'':'wheat'}}"> //根據行號 動態生成行背景顏色
<view>
<image style='width:32px;height:32px' mode="aspectFit" src="/static/icons/songList.png"></image>
</view>
<view>{{index+1}}.</view>
<view>{{item.songName}}</view>
</view>
框架:
wx:if="{{item.play==false}}" wx:else //
條件是true是false 必定要寫(坑)