下拉刷新失效
uniapp中配置下拉刷新非常简单,只需要在pages.json中做如下配置即可
"style" :
{
"enablePullDownRefresh":true,
}
然后就可以在页面中的通过onPullDownRefresh进行刷新请求
但是这个下拉刷新有时候会失效,我这里原因很简单,就是父级使用了scroll-view包裹
<scroll-view style="box-sizing: border-box;" class="p-3">
<view class="position-relative" style="min-height: 400rpx;">
<template v-if="list.length>0">
<block v-for="(item,index) in list" :key="index">
<coupon :item="item" :index="index" @click="getCoupon"></coupon>
</block>
</template>
<template v-else>
</template>
</view>
</scroll-view>
将scroll-view换成view下拉刷新就会生效了