使用promise:

function readMsg(){
return dispatch=>{
axios.post('/msgList').then(res=>{
console.log(res.data)
})
}
}

使用async+await:

function readMsg(){
return async (dispatch)=>{
const res = await axios.post('/msgList')
console.log(res.data)
}
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2020-04-06
  • 2022-12-23
  • 2022-12-23
  • 2021-10-30
猜你喜欢
  • 2022-12-23
  • 2018-06-11
  • 2018-05-11
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2021-08-28
相关资源
相似解决方案