dav.js 路由跳转以及数据更新
接口请求成功之后跳转
yield put(routerRedux.push({
pathname: '/hdgllist',
query: {},
}));
接口成功之后更新数据
yield put({
type: 'updatePayload',
payload: {
restaurantData: restaurantData,
}
});
基于action进行页面跳转
import { routerRedux } from 'dva/router';
// Inside Effects
yield put(routerRedux.push('/logout'));
// Outside Effects
dispatch(routerRedux.push('/logout'));
// With query
routerRedux.push({
pathname: '/logout',
query: {
page: 2,
},
});
function mapStateToProps(state, ownProps) {
return {
id: ownProps.params.id,
filter: ownProps.location.query.filter
};
}

浙公网安备 33010602011771号