We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
比如有一个请求 getData('post', { params: {} // 请求地址?后面拼接的参数 data: {} // body中的参数 }) 这两中参数都要传过去,useRequest 和 useRequestCallback 就没办法区别两种类型的参数,会全部拼接到?后面
The text was updated successfully, but these errors were encountered:
回晚了。useRequest虽然名字上这么叫,但它本质是对异步的封闭,和axios或fetch是完全没关系的
useRequest
useRequest的逻辑就是,你有一个异步的函数,我负责处理它的调用过程。
对于你的需求,应该这么做:
const getMyData = ({params, data}) => { return getData('post', params, data); }; useRequest(getMyData, {params: {}, data: {}});
自己再封一层函数就能处理这种情况。useRequest默认既不会拼到?后面,也不会放到body里面,因为它根本不和HTTP请求有关
?
body
Sorry, something went wrong.
感谢回复,我知道该怎么做了
No branches or pull requests
比如有一个请求
getData('post', {
params: {} // 请求地址?后面拼接的参数
data: {} // body中的参数
})
这两中参数都要传过去,useRequest 和 useRequestCallback 就没办法区别两种类型的参数,会全部拼接到?后面
The text was updated successfully, but these errors were encountered: