4 回答

大话西游666
TA贡献1817条经验 获得超14个赞
可能是你的action没有connect到组件上,没有把这个方法传过来。 参考我写的一个方案 @connect( state =; state, dispatch =; bindActionCreators(action, dispatch) ) 2.根据redux文档的方案 // 哪些 action 创建函数是我们想要通过 props 获取

湖上湖
TA贡献2003条经验 获得超2个赞
actions:
export const getMenu = () => {
return async (dispatch) => {
let msg = await fetch('data/nodes',{
method: 'POST',
//body: JSON.stringify({"aa":"aa"}),
header: {'content-type':'application/json; charset=utf-8'}
}).then((res)=>res.json());
var state = { nodes: msg };
dispatch({
type: 'INIT',
state
});
};
}
- 4 回答
- 0 关注
- 666 浏览
添加回答
举报
0/150
提交
取消