vue-request icon indicating copy to clipboard operation
vue-request copied to clipboard

[Need Help] useRequest 函数执行后返回的 data 不是 shallowRef 吗,是文档写的不对吗

Open json-66 opened this issue 6 months ago • 1 comments

问题描述 Problem Description

useRequest 函数执行后返回的 data 不是 shallowRef 吗,是文档写的不对吗

版本:2.0.4

文档上写的是:https://www.attojs.com/api/#data data 类型: shallowRef<R | undefined> 默认值: undefined 接口返回的数据。

并且 node_modules 里面的 index.d.ts 中定义的 type State<R, P> = { loading: Ref; data: Ref<R | undefined>; error: Ref<Error | undefined>; params: Ref<P>; }; data 却是 Ref

并且 vs code 中 data 提示的类型也是 Ref

其他信息 Other information

Image

Image

Image

json-66 avatar May 21 '25 09:05 json-66

shallowRef,只是类型没写 ShallowRef

John60676 avatar May 21 '25 10:05 John60676