# uni.startPullDownRefresh(options?)

开始下拉刷新

# 参数

名称 类型 必填 默认值 描述
options StartPullDownRefreshOptions | null -
名称 类型 必备 默认值 描述
success (result: AsyncApiSuccessResult) => void - 接口调用成功的回调函数
fail (result: StartPullDownRefreshFail) => void - 接口调用失败的回调函数
complete (result: AsyncApiResult) => void - 接口调用结束的回调函数(调用成功、失败都会执行)
# StartPullDownRefreshFail 的属性值
名称 类型 必备 默认值 描述
errCode number - -
errSubject string - 统一错误主题(模块)名称
data any | null - 错误信息中包含的数据
cause Error | null - 源错误信息,可以包含多个错误,详见SourceError
errMsg string - -
# AsyncApiResult 的属性值
名称 类型 必备 默认值 描述
errMsg string - -

# 返回值

类型 必备
Promise | null

# startPullDownRefresh 兼容性

Android iOS web
3.91 4.11 4.0

# 参见

相关 Bug

# uni.stopPullDownRefresh()

停止当前页面下拉刷新

使用:

  1. 首先pages.json里配置了页面可下拉刷新"enablePullDownRefresh": true
  2. 当用户下拉页面时触发页面生命周期onPullDownRefresh
  3. 在合适的时机(如联网刷新数据结束),调用本APIuni.stopPullDownRefresh(),结束下拉刷新状态

本API仅负责页面下拉刷新。如使用组件下拉刷新,另见scroll-view、list-view等组件的文档。

# stopPullDownRefresh 兼容性

Android iOS web
3.91 4.11 4.0

# 参见

相关 Bug

# 示例

hello uni-app x

Template

Script

<template>
	<scroll-view style="flex: 1;">
		<!-- 实际开发中,长列表应该使用list-view -->
		<view class="uni-padding-wrap uni-common-mt">
			<text class="text" v-for="(num,index) in data" :key="index">list - {{num}}</text>
			<view v-if="showLoadMore">{{loadMoreText}}</view>
		</view>
	</scroll-view>
</template>


<style>
	.text {
		margin: 6px 0;
		width:100%;
		background-color: #fff;
		height: 52px;
		line-height: 52px;
		text-align: center;
		color: #555;
		border-radius: 4px;
	}
</style>

# 通用类型

# GeneralCallbackResult

名称 类型 必备 默认值 描述
errMsg string - 错误信息