You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.7 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

title description spline isComponent
PullDownRefresh 下拉刷新 用于快速刷新页面信息,刷新可以是整页刷新也可以是页面的局部刷新。 message true

引入

全局引入,在 miniprogram 根目录下的app.json中配置,局部引入,在需要引入的页面或组件的index.json中配置。

"usingComponents": {
  "t-pull-down-refresh": "tdesign-miniprogram/pull-down-refresh/pull-down-refresh"
}

代码演示

顶部下拉刷新

由于组件内无法监听页面滚动,需要由页面获取组件实例,并将页面滚动事件传递到组件。

{{ base }}

在使用 pull-down-refresh 组件的页面,建议开启 disableScroll: true

API

PullDownRefresh Props

名称 类型 默认值 说明 必传
external-classes Array - 加载loading样式。['t-class', 't-class-loading','t-class-text', 't-class-indicator'] N
loading-bar-height String / Number 50 加载中下拉高度,如果值为数字则单位是:'px' N
loading-props Object - 加载loading样式。TS 类型:LoadingPropsLoading API Documents详细类型定义 N
loading-texts Array [] 提示语,组件内部默认值为 ['下拉刷新', '松手刷新', '正在刷新', '刷新完成']。TS 类型:string[] N
max-bar-height String / Number 80 最大下拉高度,如果值为数字则单位是:'px' N
refresh-timeout Number 3000 刷新超时时间 N
value Boolean false 组件状态,值为 true 表示下拉状态,值为 false 表示收起状态 N
default-value Boolean false 组件状态,值为 true 表示下拉状态,值为 false 表示收起状态。非受控属性 N

PullDownRefresh Events

名称 参数 描述
change (value: boolean) 下拉或收起时触发,用户手势往下滑动触发下拉状态,手势松开触发收起状态
refresh - 结束下拉时触发
scrolltolower - 滚动到页面底部时触发
timeout - 刷新超时触发