We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<View style={{flex: 1}}> <RefreshListView data={this.state.goodlist} keyExtractor={this.keyExtractor} renderItem={this.renderCell} refreshState={this.state.refreshState} onHeaderRefresh={this.onHeaderRefresh.bind()} onFooterRefresh={this.onFooterRefresh.bind()} // 可选 footerRefreshingText= '玩命加载中 >.<' footerFailureText = '我擦嘞,居然失败了 =.=!' footerNoMoreDataText= '-我是有底线的-' footerEmptyDataText= '-好像什么东西都没有-' /> </View> onHeaderRefresh = () => { // 下拉刷新 this.setState({refreshState: RefreshState.HeaderRefreshing}, () => { this.getGoods(true, {offset: 0}) }) } onFooterRefresh = () => { // 上拉加载 this.setState({refreshState: RefreshState.FooterRefreshing}, () => { const params = { offset: this.state.offset + 10, } this.getGoods(false, params) }) } getGoods = (isReload, params) => { let reqparams = { systemBookCode: "4344", department: "", categoryCode: "", offset: this.state.offset, limit: this.state.limit, sortField: "item_code", sortBy: "asc" } if (params) { reqparams = { ...reqparams, ...params, } } if (isReload) { // 下拉刷新出前10条数据 console.log('前10条数据查询条件', reqparams) postJSON(getgoodUrl, reqparams, (res) => { console.log(res) if (res.code === 0) { if (res.data && res.data.length > 0) { this.setState({ // ...params, goodlist: res.data, offset: 0, refreshState: res.data.length < 1 ? RefreshState.EmptyData : RefreshState.Idle, }); } else { this.setState({ goodlist: [], refreshState: RefreshState.EmptyData }) } } else { this.setState({ refreshState: RefreshState.Failure }) } }) } else { // this.setState({refreshState: RefreshState.HeaderRefreshing}) // 上拉加载更多 console.log('false请求参数', reqparams) postJSON(getgoodUrl, reqparams, (res) => { if (res.code === 0) { if (res.data.length > 0) { let newdatalist = this.state.goodlist.concat(res.data) this.setState({ // ...params, goodlist: newdatalist, offset: reqparams.offset, refreshState: res.data.length < 1 ? RefreshState.EmptyData : RefreshState.Idle, }); } else { this.setState({ refreshState: res.data.length < 1 ? RefreshState.NoMoreData : RefreshState.Idle, }); } } else { this.setState({ refreshState: RefreshState.Failure }) } }) } }
The text was updated successfully, but these errors were encountered:
我有同样的问题 请问解决了么
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: