useIsFetching 是一個可選用的鉤子 (hook),它會回傳你的應用程式正在背景載入或擷取中的查詢 數量(適用於全應用程式的載入指示器)。
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'] })
選項
回傳值