import React, { useEffect, useState } from 'react' import { InfiniteList, CommonCard } from '@zhst/biz' import { uniqueId } from '@zhst/func' export default () => { const [data, setData] = useState([]) const [loading, setLoading] = useState(false) const loadMoreData = () => { if (loading) { return; } setLoading(true); fetch('https://randomuser.me/api/?results=10&inc=id,key,name,gender,email,nat,picture&noinfo') .then((res) => res.json()) .then((body) => { let res = body.results.map((o, index) => { return { id: uniqueId(), sort: index + 1, title: o.name.first, subtitle: o.name.last, url: o.picture.large } }) setData([...data, ...res]); setLoading(false); }) .catch(() => { setLoading(false); }); }; useEffect(() => { loadMoreData(); }, []); return ( { return ( 创建检索, 创建布控, 删除点位 ]} /> ) }} /> ) }