Nuxt URQL 模块
Nuxt v3 和 v4 的 URQL 客户端
特征
- @urql/vue 整合
- 安全部门改革交换
- 客户端定制
快速设置
添加 @bicou/nuxt-urql 对您的项目的依赖性
# Using pnpm
pnpm add -D @bicou/nuxt-urql graphql
# Using yarn
yarn add --dev @bicou/nuxt-urql graphql
# Using npm
npm install --save-dev @bicou/nuxt-urql graphql
添加 @bicou/nuxt-urql 页:1 modules 节 nuxt.config.ts 财务报告和审定财务报表
配置 urql 客户端 url
export default defineNuxtConfig({
modules: [
'@bicou/nuxt-urql'
],
urql: {
endpoint: "http://myapi/graphql"
}
})
就这样! 您现在可以在您的 Nuxt app QQ 中使用 Nuxt URQL 模块
<template>
<div>{{ data }}</div>
</template>
<script setup lang="ts">
const { data } = await useQuery({
query: gql`
query name {
# ...
}
`,
});
</script>
发展
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Run Vitest
npm run test
npm run test:watch