feat: page下拉刷新配置

This commit is contained in:
hongyang03 2022-03-16 19:55:18 +08:00
parent 6c255cd309
commit cf1fb97f4d
2 changed files with 20 additions and 3 deletions

View File

@ -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 | | 配置下拉刷新后下拉释放后触发(仅用于移动端) |
## 动作表

View File

@ -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,