4 回答

qq_笑_17
TA貢獻1818條經(jīng)驗 獲得超7個贊
可能是你的action沒有connect到組件上,沒有把這個方法傳過來。 參考我寫的一個方案 @connect( state =; state, dispatch =; bindActionCreators(action, dispatch) ) 2.根據(jù)redux文檔的方案 // 哪些 action 創(chuàng)建函數(shù)是我們想要通過 props 獲取

慕村225694
TA貢獻1880條經(jīng)驗 獲得超4個贊
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 關注
- 1230 瀏覽
添加回答
舉報
0/150
提交
取消