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
Options.ready
在依赖请求中比较有用。目前ready只接受Ref<Boolean>,所以不能直接传Ref<Data>,需要写computed。希望可以接受Ref<unknown>并检测truthy。
ready
Ref<Boolean>
Ref<Data>
computed
Ref<unknown>
const api1Context = useRequest(api1); /* const api2Context = useRequest(api2, { ready: api1Context.data, // 类型错误 }; */ const isApi1Ready = computed(() => !!api1Context.data); const api2Context = useRequest(api2, { ready: isApi1Ready, // 类型正确 });
State.finished
loaded
这个其实是对标useAxios的isFinished ,因为如果给了initialData的话,没有办法从State判断当前是不是已经加载完成了,还是得监听onSuccess、onAfter之类的事件。每次都要写一段样板代码也不是很方便,还是希望能加上。
useAxios
isFinished
initialData
State
onSuccess
onAfter
refreshDeps
WatchSource
单纯的语法糖,和vue的watch一样,用isArray判断一下就好了。
vue
watch
isArray
The text was updated successfully, but these errors were encountered:
Good suggestion
Sorry, something went wrong.
feat: enhanced refreshDeps, now can be used like watch #166
ceb4302
feat: ready supports passing functions #166
b210f5c
No branches or pull requests
需求描述 Feature Description
1.
Options.ready
检测truthy在依赖请求中比较有用。目前
ready
只接受Ref<Boolean>
,所以不能直接传Ref<Data>
,需要写computed
。希望可以接受Ref<unknown>
并检测truthy。2.
State.finished
(或者叫loaded
、ready
之类的也行)这个其实是对标
useAxios
的isFinished
,因为如果给了initialData
的话,没有办法从State
判断当前是不是已经加载完成了,还是得监听onSuccess
、onAfter
之类的事件。每次都要写一段样板代码也不是很方便,还是希望能加上。3.
refreshDeps
接受单个WatchSource
单纯的语法糖,和
vue
的watch
一样,用isArray
判断一下就好了。建议的解决方案 Proposed Solution
其他信息 Other information
The text was updated successfully, but these errors were encountered: