定时器逻辑
定时器为绑定到视图或部件上逻辑,每隔一定时间执行脚本内容代码。
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| document | Document | 当前文档对象 |
| selector | (className: string) => HTMLCollectionOf<Element> | 元素选择器 |
| env | IEnvironment | 当前环境对象 |
| appSession | IApiData | 当前应用会话对象 |
| topViewSession | IApiData | 当前顶级视图会话对象 |
| viewSession | IApiData | 当前视图会话对象 |
| context | IApiContext | 当前视图上下文 |
| viewParam | IApiParams | 当前视图参数 |
| data | IApiData[] | 当前业务数据 |
| app | IApiAppHubController | 当前应用 |
| topView | IApiViewController | 当前顶级视图 |
| parentView | IApiViewController | undefined | 当前父视图 |
| view | IApiViewController | 当前视图 |
| parent | IApiViewController | undefined | 当前父视图 |
| util | { message: IApiMessageUtil, notification: IApiNotificationUtil,modal: IApiModalUtil,confirm: IApiConfirmUtil,openView: IApiOpenViewUtil} | 工具集 |
| ctrl | IApiControlController | undefined | 当前部件 |
调用示例
根据配置的间隔,定时刷新表格部件数据
typescript
ctrl.refresh();使用定时器逻辑切换表格分页
if (ctrl.state.curPage=== ctrl.state.totalPages) {
ctrl.state.curPage = 1;
} else {
ctrl.state.curPage += 1;
}
ctrl.load();