mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
feat: page下拉刷新配置
This commit is contained in:
parent
6c255cd309
commit
cf1fb97f4d
@ -273,4 +273,12 @@ Page 默认将页面分为几个区域,分别是**内容区(`body`)**、**
|
||||
| interval | `number` | `3000` | 刷新时间(最小 1000) |
|
||||
| silentPolling | `boolean` | `false` | 配置刷新时是否显示加载动画 |
|
||||
| stopAutoRefreshWhen | [表达式](../../docs/concepts/expression) | `""` | 通过表达式来配置停止刷新的条件 |
|
||||
| pullRefresh | `object` | `{disabled: true}` | 下拉刷新配置 |
|
||||
| pullRefresh | `object` | `{disabled: true}` | 下拉刷新配置(仅用于移动端) |
|
||||
|
||||
## 事件表
|
||||
| 事件名称 | 事件参数 | 说明 |
|
||||
| ----------- | ------ | ------------------------------------- |
|
||||
| pullRefresh | | 配置下拉刷新后下拉释放后触发(仅用于移动端) |
|
||||
|
||||
## 动作表
|
||||
无
|
@ -12,7 +12,7 @@ import {
|
||||
FunctionPropertyNames
|
||||
} from '../types';
|
||||
import {filter, evalExpression} from '../utils/tpl';
|
||||
import {isVisible, autobind, bulkBindFunctions} from '../utils/helper';
|
||||
import {isVisible, autobind, bulkBindFunctions, createObject} from '../utils/helper';
|
||||
import {ScopedContext, IScopedContext} from '../Scoped';
|
||||
import Alert from '../components/Alert2';
|
||||
import {isApiOutdated, isEffectiveApi} from '../utils/api';
|
||||
@ -617,10 +617,19 @@ export default class Page extends React.Component<PageProps> {
|
||||
}
|
||||
|
||||
@autobind
|
||||
handleRefresh() {
|
||||
async handleRefresh() {
|
||||
const {dispatchEvent, data} = this.props;
|
||||
const rendererEvent = await dispatchEvent('pullRefresh', createObject(data));
|
||||
if (rendererEvent?.prevented) {
|
||||
return;
|
||||
}
|
||||
this.reload();
|
||||
}
|
||||
|
||||
doAction(action: Action, data: object, throwErrors: boolean = false) {
|
||||
return this.handleAction(undefined, action, data);
|
||||
}
|
||||
|
||||
handleChange(
|
||||
value: any,
|
||||
name: string,
|
||||
|
Loading…
Reference in New Issue
Block a user