snapshot of https://github.com/TanStack/query.git (main, 2026-09-16; blobs > 131072B omitted)
Some checks failed
autofix.ci / autofix (push) Failing after 4s
Release / Release (push) Has been skipped
GitHub Actions Security Analysis / Run zizmor (push) Failing after 2s

This commit is contained in:
upstream-mirror
2026-09-16 01:13:08 +05:00
commit 3a013ccdfe
3570 changed files with 490194 additions and 0 deletions

9
examples/vue/simple/.gitignore vendored Normal file
View File

@@ -0,0 +1,9 @@
node_modules
.DS_Store
dist
dist-ssr
*.local
package-lock.json
yarn.lock
pnpm-lock.yaml

View File

@@ -0,0 +1,6 @@
# Simple example
To run this example:
- `npm install` or `yarn` or `pnpm i` or `bun i`
- `npm run dev` or `yarn dev` or `pnpm dev` or `bun dev`

View File

@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>TanStack Query Vue Simple Example App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

View File

@@ -0,0 +1,20 @@
{
"name": "@tanstack/query-example-vue-simple",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"@tanstack/vue-query": "^5.102.8",
"@tanstack/vue-query-devtools": "^6.1.48",
"vue": "^3.4.27"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.2.1",
"typescript": "5.8.3",
"vite": "^6.4.1"
}
}

View File

@@ -0,0 +1,43 @@
<script lang="ts">
import { defineComponent } from 'vue'
import { useQuery } from '@tanstack/vue-query'
import { VueQueryDevtools } from '@tanstack/vue-query-devtools'
export default defineComponent({
name: 'App',
components: { VueQueryDevtools },
setup() {
const { data, error, isFetching, isPending } = useQuery({
queryKey: ['repoData'],
async queryFn() {
return await fetch('https://api.github.com/repos/Tanstack/query').then(
(response) => response.json(),
)
},
})
return {
data,
error,
isFetching,
isPending,
}
},
})
</script>
<template>
<template v-if="isPending"> Loading... </template>
<template v-else-if="error">
'An error has occurred: {{ error.message }}
</template>
<template v-else>
<h1>{{ data.name }}</h1>
<p>{{ data.description }}</p>
<strong>👀 {{ data.subscribers_count }}</strong>
<strong>✨ {{ data.stargazers_count }}</strong>
<strong>🍴 {{ data.forks_count }}</strong>
<div>{{ isFetching ? 'Updating...' : '' }}</div>
</template>
<VueQueryDevtools />
</template>

View File

@@ -0,0 +1,6 @@
import { createApp } from 'vue'
import { VueQueryPlugin } from '@tanstack/vue-query'
import App from './App.vue'
createApp(App).use(VueQueryPlugin).mount('#app')

View File

@@ -0,0 +1,5 @@
declare module '*.vue' {
import { DefineComponent } from 'vue'
const component: DefineComponent<{}, {}, any>
export default component
}

6
examples/vue/simple/src/types.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
export interface Post {
userId: number
id: number
title: string
body: string
}

View File

@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"jsx": "preserve",
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"],
"types": ["vite/client"]
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue"]
}

View File

@@ -0,0 +1,9 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [vue()],
optimizeDeps: {
exclude: ['@tanstack/vue-query', 'vue-demi'],
},
})