1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import modelExtend from 'dva-model-extend';
- const model = {
- reducers: {
- updateState(state, { payload }) {
- return {
- ...state,
- ...payload,
- };
- },
- },
- };
- const pageModel = modelExtend(model, {
- state: {
- list: [],
- pagination: {
- showSizeChanger: true,
- showQuickJumper: true,
- showTotal: total => `共 ${total} 条`,
- current: 1,
- total: 0,
- },
- },
- reducers: {
- querySuccess(state, { payload }) {
- const { list, pagination } = payload;
- return {
- ...state,
- list,
- pagination: {
- ...state.pagination,
- ...pagination,
- },
- };
- },
- },
- });
- module.exports = {
- model,
- pageModel,
- };
|