index.wxml文件
<swiper indicator-dots=“true” autoplay=“true” interval=“5000” duration=“1000” style=“height:180px;”>
<block wx:for="{{topNews}}">
<swiper-item>
<image src="{{item.news_small_picture}}" style=“width:100%;” />
</swiper-item>
</block>
</swiper>
<block wx:for="{{ListNews}}">
<navigator url="" class=“weui-media-box weui-media-box_appmsg” hover-class=“weui-cell_active” bindtap=“news_list” data-newsid="{{item.id}}">
<view id=“show_picture” name=“show_picture” class=“weui-media-box__hd weui-media-box__hd_in-appmsg {{show_picture}}”>
<image class=“weui-media-box__thumb” src="{{item.news_small_picture}}" />
</view>
<view class=“weui-media-box__bd weui-media-box__bd_in-appmsg”>
<view class=“weui-media-box__title” style=“display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;word-wrap:break-word;white-space:normal !important;-webkit-box-orient:vertical;height:55px;”>
{{item.news_title}}
</view>
<view class=“weui-media-box__desc”>{{item.news_plate_name}}<text style=“float:right;”>{{item.createdAt}}</text></view>
</view>
</navigator>
</block>
在index.js用wx.request获取到数据,然后赋值。
that.setData({
topNews : res.data,
techNews : res.data,
ListNews : res.data,
show_picture:’’
})
得出的列表,上下滑动不是很顺,请问代码需要怎么优化。