Query Docs
Examples
- Basic
- Vue 2.6
- Vue 2.7
- Simple (Nuxt 3)
- Simple (Nuxt 4)
- Persister
- Basic w/ GraphQL-Request
- Default Query Function
- Playground
- Algolia
- Shadow DOM
- Devtools Embedded Panel
- Chat example (streaming)
- Star Wars (Vue Router)
- Rick And Morty (Vue Router)
- Vue Router
- Offline Queries and Mutations (Vue Router)
- Suspense
- Batching
- Auto Refetching / Polling / Realtime (Nuxt 4)
- Optimistic Updates (Nuxt 4)
- Pagination (Nuxt 4)
- Load-More & Infinite Scroll (Nuxt 4)
- Infinite query with Max pages (Nuxt 4)
- Prefetching (Nuxt 4)
Vue Example: Persister
<script setup lang="ts">
import { ref } from 'vue'
import PostList from './PostList.vue'
import PostDetail from './PostDetail.vue'
const postId = ref(-1)
const setPostId = (id: number) => {
postId.value = id
}
</script>
<template>
<h1>Vue Query - Persister</h1>
<p>
As you visit the posts below, you will notice them in a loading state the
first time you load them. However, after you return to this list and click
on any posts you have already visited again, you will see them load
instantly and background refresh right before your eyes!
<strong>
(You may need to throttle your network speed to simulate longer loading
sequences)
</strong>
</p>
<PostDetail v-if="postId > -1" :post-id="postId" @set-post-id="setPostId" />
<PostList v-else @set-post-id="setPostId" />
</template>