Pulltorefresh
Pulltorefresh UI 提供与WeLink规范一致的视图。
需安装下组件 npm 包:
npm install @wecode/pulltorefresh-react
参数说明
名称 | 类型 | 默认值 | 说明 |
---|---|---|---|
mainElement | string | 刷新的id | |
onRefresh | func | 刷新回调 |
效果示例
HTML
import React from 'react';
import PullToRefresh from '@wecode/pulltorefresh-react';
const pullToRefreshTxt = {
display: 'block',
padding: '10px',
fontSize: '14px',
textAlign: 'center'
};
export default function RefreshDemo() {
return (
<PullToRefresh
mainElement="refresh-demo"
onRefresh={() => new Promise(resolve => {
setTimeout(() => {
resolve();
}, 1000);
})
}
>
<span style={pullToRefreshTxt}>下拉查看效果</span>
</PullToRefresh>
);
}