页面滑动有点卡
发布于 6 年前 作者 tao60 10941 次浏览 来自 问答

我在index中做了一个新闻列表页面,但上下滑动时感觉有点卡。我手机用别的小程序,上下滑动又很顺。

能帮忙看看吗?

4 回复

有没有帮忙看看

有人帮忙看看吗?

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:’’

})

得出的列表,上下滑动不是很顺,请问代码需要怎么优化。

用什么组件?

回到顶部