<PullToRefresh damping={50 as any} className='pullToRefresh' getScrollContainer={() => undefined} distanceToRefresh={40} style={{ height: hei, overflow: 'auto' }} indicator={{ deactivate: '下拉刷新' } as any} direction={'down' as any} refreshing={refreshing as any} onRefresh={() => { setRefreshing(true) setTimeout(() => { setRefreshing(false); initData() }, 1000); }} >
加上下面代码即可
getScrollContainer={() => undefined}
distanceToRefresh={40}
获取offsetTop出错
var engineeType = document.querySelector('#engineeType').clientHeight; var pullToRefresh = document.querySelector('.pullToRefresh')['offsetTop']; let hei = engineeType - pullToRefresh; setTimeout(() => setHei(hei), 0);