Taro data list.
npm install @jswork/taro-data-listshell
npm i @jswork/taro-data-list
`usage
`jsx
import TaroDataList from '@jswork/taro-data-list'; 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 (
{item.id}
Hello {item.title}
);
}
if (action === "LOAD_MORE") {
return 上滑加载更多... ;
}
if (action === "INIT") {
return 数据加载中... ;
}
if (action === "NO_MORE") {
return (
没有可以加载的数据啦
);
}
}}
/>
``