Alipay JSSDK V3.1.1

ap.onPullDownRefresh(CALLBACK)

监听页面下拉事件。

CALLBACK 参数说明

名称类型描述
refreshAvailableBoolean是否可刷新。可通过ap.allowPullDownRefresh()设置此返回值

代码示例

<script src="https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.inc.min.js"></script>

<h2 class="am-ft-center">下拉试试</h2>
<script>
  ap.allowPullDownRefresh(false);
  ap.onPullDownRefresh(function(res){
    if(!res.refreshAvailable){
      ap.alert({
        content: '刷新已禁止',
        buttonText: '恢复'
      }, function(){
        ap.allowPullDownRefresh(true);
        ap.showToast('刷新已恢复')
      });
    }
  });
</script>