Commit 4c8ef953 authored by JoeyKo's avatar JoeyKo Committed by 偏右

fix fetchMore

parent 62ab8b47
...@@ -15,6 +15,13 @@ export default { ...@@ -15,6 +15,13 @@ export default {
payload: Array.isArray(response) ? response : [], payload: Array.isArray(response) ? response : [],
}); });
}, },
*appendFetch({ payload }, { call, put }) {
const response = yield call(queryFakeList, payload);
yield put({
type: 'appendList',
payload: Array.isArray(response) ? response : [],
});
},
*submit({ payload }, { call, put }) { *submit({ payload }, { call, put }) {
let callback; let callback;
if (payload.id) { if (payload.id) {
...@@ -37,5 +44,11 @@ export default { ...@@ -37,5 +44,11 @@ export default {
list: action.payload, list: action.payload,
}; };
}, },
appendList(state, action) {
return {
...state,
list: state.list.concat(action.payload),
};
},
}, },
}; };
...@@ -19,7 +19,13 @@ const pageSize = 5; ...@@ -19,7 +19,13 @@ const pageSize = 5;
})) }))
class SearchList extends Component { class SearchList extends Component {
componentDidMount() { componentDidMount() {
this.fetchMore(); const { dispatch } = this.props;
dispatch({
type: 'list/fetch',
payload: {
count: 5,
},
});
} }
setOwner = () => { setOwner = () => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment