我用了scroll-view标签来作为整个页面的容器,内容多,方便浏览,这时就发现下拉刷新不了,所以怎样下拉刷新+页面支持下滑?
答案是scroll-view改为view,height由100vh改为100%即可。至于下拉刷新的配置不用多讲吧。
wxml文件
<view scroll-y class="scrollPage">
<cu-custom isCustom="{{true}}">
<view slot="backText">返回</view>
</cu-custom>
<image src='/resource/image/banner/componentBg.png' mode='widthFix' class='response'>
</image>
<!-- 卡片 -->
<view class="cu-list menu ">
<view class="cu-item arrow" wx:for="{{newsList}}">
<view class="content padding-tb-sm">
<view>
<text class="cuIcon-hotfill text-blue margin-right-xs"></text>{{item.title}}</view>
<view class="text-gray text-sm">
<text class="cuIcon-timefill margin-right-xs"></text>{{item.time}}</view>
</view>
</view>
</view>
</view>
wxss文件
.scrollPage {
height: 100%;
}
然后json文件配置
{
"usingComponents": {},
"enablePullDownRefresh": true
}
js文件
onPullDownRefresh: function () {
this.getInfo()
},