1.0.9 • Published 3 years ago

@jswork/taro-data-list v1.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

taro-data-list

Taro data list.

installation

npm i @jswork/taro-data-list

usage

import TaroDataList from '@jswork/taro-data-list';

<TaroDataList
  scrollY
  refresherEnabled
  api={this.apiService}
  size={20}
  dataGetter={(e) => e.data}
  hasMore={(e) => {
    console.log("e", e, e.data.length <= 10);
    return e.data.length === 20;
  }}
  onChange={(e) => {
    const { items } = e.target.value;
    this.setState({ dataSource: items });
  }}
  template={(action, args) => {
    if (action === "ITEM") {
      const { item, index } = args;
      return (
        <View className="template-item">
          <Text>{item.id}</Text>
          <Checkbox checked={item.complete} />
          <Text>Hello {item.title}</Text>
        </View>
      );
    }

    if (action === "LOAD_MORE") {
      return <View className="template-init">上滑加载更多...</View>;
    }

    if (action === "INIT") {
      return <View className="template-init">数据加载中...</View>;
    }

    if (action === "NO_MORE") {
      return (
        <View className="template-no-more">没有可以加载的数据啦</View>
      );
    }
  }}
/>
1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago