# Pull 下拉刷新组件

---

Pull 组件，高阶组件，可以给容器上拉、下拉、滚动到顶部、底部等回调事件。

## 使用指南

在 Taro 文件中引入组件

:::demo

```js
import { Pull } from "taro-tools-ui";
```

:::

**组件依赖的样式文件（仅按需引用时需要）**

:::demo

```scss
@import "~taro-tools-ui/dist/components/pull.scss";
```

:::

## 一般用法

说明：

- 该组件为高阶组件，定义了上拉下拉和滚动条相关事件，支持在头部和底部传入自定义动画，支持自定义容器高度，如果不设置容器高度，默认容器为视窗高度。

:::demo

```js
import Taro, { Component, Config } from "@tarojs/taro";
import { View, Text, ScrollView } from "@tarojs/components";
import { AtActivityIndicator } from 'taro-ui';

import Pull from "@/components/pull";
import "./index.scss";

class Index extends Component<IndexProps, IndexState> {
  config: Config = {
    navigationBarTitleText: 'index',
    disableScroll: true,
  }

  onPullDown() {
    console.log('pulldown');
  }


  render() {
    return (
      <Pull
      onPullDown = { this.onPullDown }
      onPullUp = { this.onPullDown }
      headerCustom = { true }
      renderHeader = { <View>自定义下拉动画</View> }
      footerCustom = { true }
      renderFooter = { <View>自定义上拉动画</View> }>
        <View>
          测试列表内容
          测试列表内容
          测试列表内容
          测试列表内容
          测试列表内容
          测试列表内容
          测试列表内容
          测试列表内容
          测试列表内容
        </View>
      </Pull>
    );
  }
}
```

:::

## 参数

| 参数        | 说明                       | 类型        | 可选值 | 默认值 |
| ----------- | ------------------------- | -----------| ------| ------ |
| onLower     | 滚动条到底部回调方法         | Function   | 可选   | -      |
| onUpper     | 滚动条到顶部回调方法         | Function   | 可选   | -      |
| onPullUp    | 上拉回调方法                | Function   | 可选   | -      |
| onPullDown  | 下拉回调方法                | Function   | 可选   | -      |
| headerCustom| 顶部下拉是否使用自定义组件    | Boolean    | 可选   | -      |
| renderHeader| 下拉时顶部自定义动画         | JSX.Element| 可选   | -      |
| footerCustom| 底部上拉是否使用自定义组件    | Boolean   | 可选   | -      |
| renderFooter| 上拉时顶部自定义动画         | JSX.Element| 可选   | -      |
| warpperHeight| 容器自定义高度             | Number     | 可选   | -      |

## 事件

| 事件名称 | 说明                 | 返回参数 |
| -------- | -------------------- | -------- |
