当我使用ahooks 的 useRequest 时 报错--Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'then')
请问一下这个怎么处理呢????
options里面写onSuccess函数处理返回参数
options里面写onSuccess函数处理返回参数
方便详细说一下吗,不是很理解你说的,这个和处理返回蚕食有什么问题呢
@chenJJ-88 请提供一个 demo 呢
Hello @chenJJ-88. Please provide a online reproduction by forking this link https://codesandbox.io/s/ok2fe or a minimal GitHub repository. Issues labeled by Need Reproduce will be closed if no activities in 3 days.
你好 @chenJJ-88, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 此处 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。3 天内未跟进此 issue 将会被自动关闭。

看截图这个目录结构和文件名,感觉不像是 v3 的 ahooks,像是 v2 版本的。应该是用的这个包:https://www.npmjs.com/package/@ahooksjs/use-request
楼主用了 v2 的这个用法:
https://ahooks-v2.js.org/zh-CN/hooks/async#%E9%9B%86%E6%88%90%E8%AF%B7%E6%B1%82%E5%BA%93
然后他的 service 传函数时,返回值出现了 undefined,导致:s.then 取值报错:
@chenJJ-88 你应该调整 service 函数的返回值,不能返回假值(null, undefined)
另外 v2 已经不再维护,可以的话请升级最新版本