Model层
export default {
namespace: 'Statemanagement',
state: {
data:[],
pagination: {
pageSize: 10,
pageSizeOptions:["10"],
showSizeChanger: true,
showTotal: total => `共${total}条数据`,
showQuickJumper: true,
},
},
effects: {
*trade({ payload }, { call, put }) {
const response = yield call( '' , payload);
if(response.code===200){
yield put({ type: 'save', payload: {
data:response.rows,
pagination: {
pageSize: payload.pageSize,
total: response.total,
current: payload.pageNum,
showTotal: total => `共${total}条数据`,
showQuickJumper: true,
},
}
});
}
},
},
reducers: {
。。。。。。。。。。。。。。。。。。
}
}
js层
class Statement extends Component {
constructor(props){
super(props);
this.state={}
}
componentDidMount() {
this.submit();
}
handleSubmit = () => {
this.props.dispatch({
type: 'Statemanagement/trade',
payload: {},
})
}
render() {
const { data , pagination} = this.props.Statemanagement;
const columns = [];
return (
<div>
<Table rowKey={(item, index) => index} columns={columns} dataSource={data} pagination={pagination} />
</div>
);
}
}
export default Statement;