从后端获取的数据,在页面渲染需要setData
this.setData({
key: value
})
for循环
<view wx:for="{{array}}" wx:key="index">
{{index}}: {{item.message}}
</view>
if判断
<view wx:if="{{length > 5}}">1</view>
<view wx:elif="{{length > 2}}">2</view>
<view wx:else>3</view>
动态设置标题
wx.setNavigationBarTitle({
title: nickname
})
网友评论