一般setData方法多用于点击后改变页面信息或者刷新后与后台交互获取最新的信息
注意:
直接修改 this.data 而不调用 this.setData 是无法改变页面的状态的,还会造成数据不一致单次设置的数据不能超过1024kB,请尽量避免一次设置过多的数据。
微信小程序flex布局:
<view class="flex-wrp" style="flex-direction:row; display: flex;"> <view class="flex-item" style="background:green; width:20%;">1</view> <view class="flex-item" style="background:red;width:20%;">2</view> <view class="flex-item" style="background:blue;width:20%;">3</view> </view> <view class="section"> <view class="section__title">左面20% 右面20%</view> <view class="flex-wrp" style="height: 300px; display: flex; justify-content:space-between"> <view class="flex-item" style="background:green;width:20%;">1</view> <view class="flex-item" style="background:red;width:20%;">2</view> <view class="flex-item" style="background:blue;width:20%;">3</view> </view> </view> 微信小程序WXSS: https://developers./miniprogram/dev/framework/view/wxss.html