useIsFetching 是一个可选的钩子,它返回您的应用程序在后台加载或获取的查询的 number(对于应用程序范围的加载指示器很有用)。
import { useIsFetching } from '@tanstack/vue-query'
// 有多少个查询正在获取?
const isFetching = useIsFetching()
// 有多少个与 posts 前缀匹配的查询正在获取?
const isFetchingPosts = useIsFetching({ queryKey: ['posts'] })
import { useIsFetching } from '@tanstack/vue-query'
// 有多少个查询正在获取?
const isFetching = useIsFetching()
// 有多少个与 posts 前缀匹配的查询正在获取?
const isFetchingPosts = useIsFetching({ queryKey: ['posts'] })
选项
返回值