1. When using ant-design-mobile
the ListView
components, the problem I encountered was that the page data was not completely refreshed and emptied when the pull refresh was performed, so I encountered a series of problems.
2. At this time, I thought of finding a way to force a page refresh or a way to React
re-render, but react-app
there are some peculiarities when used , so the above two methods did not work. Instead, it will cause the problem of refreshing the blank login on the app.
3, because based dva.js
development, the conceivable method is to directly in another model
data synchronization processing, a method to define the data to be processed can be emptied.
Code example
- In
model
the corresponding definition of a data processing method for emptying
clearData(state) {
return {
...state,
data: [], // 数据清空
dataSource: dataUtils.getListViewDataSource(),
pagination: {
...networkUtils.pagination },
};
},
- Just call it synchronously in the corresponding place of the component.
dispatch({
type: 'createDynamics/clearData'
})
In this way, it is very simple to solve the various problems that the data is not cleared.