Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
281 changes: 196 additions & 85 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,104 +1,215 @@
module.exports = {
title: 'Vue Apollo',
description: '🚀 Integrate GraphQL in your Vue.js apps!',
base: '/vue-apollo/',
serviceWorker: true,
head: [
['link', { rel: 'icon', href: '/favicon.png' }],
],
locales: {
'/': {
lang: 'en-US',
title: 'Vue Apollo',
description: '🚀 Integrate GraphQL in your Vue.js apps!',
},
'/zh-cn/': {
lang: 'zh-CN',
title: 'Vue Apollo',
description: '🚀 在你的 Vue.js 应用中集成 GraphQL!',
}
},
themeConfig: {
repo: 'Akryum/vue-apollo',
docsDir: 'docs',
editLinks: true,
lastUpdated: 'Last Updated',
nav: [
{
text: 'Guide',
link: '/guide/',
},
{
text: 'API Reference',
link: '/api/',
},
{
text: 'Migration',
link: '/migration/',
},
{
text: 'CLI plugin',
link: 'https://github.com/Akryum/vue-cli-plugin-apollo',
},
{
text: 'Patreon',
link: 'https://www.patreon.com/akryum',
},
],
sidebarDepth: 3,
sidebar: {
'/guide/': [
'',
'installation',
{
title: 'Basic Usage',
collapsable: false,
children: [
'apollo/',
'apollo/queries',
'apollo/mutations',
'apollo/subscriptions',
'apollo/pagination',
locales: {
'/': {
selectText: 'Languages',
label: 'English',
lastUpdated: 'Last Updated',
nav: [
{
text: 'Guide',
link: '/guide/',
},
{
text: 'API Reference',
link: '/api/',
},
{
text: 'Migration',
link: '/migration/',
},
{
text: 'CLI plugin',
link: 'https://github.com/Akryum/vue-cli-plugin-apollo',
},
{
text: 'Patreon',
link: 'https://www.patreon.com/akryum',
},
],
sidebarDepth: 3,
sidebar: {
'/guide/': [
'',
'installation',
{
title: 'Basic Usage',
collapsable: false,
children: [
'apollo/',
'apollo/queries',
'apollo/mutations',
'apollo/subscriptions',
'apollo/pagination',
],
},
{
title: 'Components',
collapsable: false,
children: [
'components/',
'components/query',
'components/mutation',
'components/subscribe-to-more',
],
},
{
title: 'Advanced topics',
collapsable: false,
children: [
'multiple-clients',
'ssr',
'local-state',
'testing',
],
},
],
},
{
title: 'Components',
collapsable: false,
children: [
'components/',
'components/query',
'components/mutation',
'components/subscribe-to-more',
'/api/': [
{
title: 'Vue Apollo',
collapsable: false,
children: [
'apollo-provider',
'dollar-apollo',
'ssr',
],
},
{
title: 'Smart Apollo',
collapsable: false,
children: [
'smart-query',
'smart-subscription',
],
},
{
title: 'Apollo Components',
collapsable: false,
children: [
'apollo-query',
'apollo-subscribe-to-more',
'apollo-mutation',
],
},
],
'/migration/': [''],
},
{
title: 'Advanced topics',
collapsable: false,
children: [
'multiple-clients',
'ssr',
'local-state',
'testing',
],
},
],
'/api/': [
{
title: 'Vue Apollo',
collapsable: false,
children: [
'apollo-provider',
'dollar-apollo',
'ssr',
],
},
{
title: 'Smart Apollo',
collapsable: false,
children: [
'smart-query',
'smart-subscription',
},
'/zh-cn/': {
selectText: '选择语言',
label: '简体中文',
editLinks: true,
lastUpdated: '上次更新时间',
nav: [
{
text: '指南',
link: '/zh-cn/guide/',
},
{
text: 'API 参考',
link: '/zh-cn/api/',
},
{
text: '迁移',
link: '/zh-cn/migration/',
},
{
text: 'CLI 插件',
link: 'https://github.com/Akryum/vue-cli-plugin-apollo',
},
{
text: '赞助作者',
link: 'https://www.patreon.com/akryum',
},
],
sidebarDepth: 3,
sidebar: {
'/zh-cn/guide/': [
'',
'installation',
{
title: '基本使用',
collapsable: false,
children: [
'apollo/',
'apollo/queries',
'apollo/mutations',
'apollo/subscriptions',
'apollo/pagination',
],
},
{
title: '组件',
collapsable: false,
children: [
'components/',
'components/query',
'components/mutation',
'components/subscribe-to-more',
],
},
{
title: '进阶',
collapsable: false,
children: [
'multiple-clients',
'ssr',
'local-state',
'testing',
],
},
],
},
{
title: 'Apollo Components',
collapsable: false,
children: [
'apollo-query',
'apollo-subscribe-to-more',
'apollo-mutation',
'/zh-cn/api/': [
{
title: 'Vue Apollo',
collapsable: false,
children: [
'apollo-provider',
'dollar-apollo',
'ssr',
],
},
{
title: 'Smart Apollo',
collapsable: false,
children: [
'smart-query',
'smart-subscription',
],
},
{
title: 'Apollo 组件',
collapsable: false,
children: [
'apollo-query',
'apollo-subscribe-to-more',
'apollo-mutation',
],
},
],
'/zh-cn/migration/': [''],
},
],
'/migration/': [''],
},
},
},
}
20 changes: 20 additions & 0 deletions docs/zh-cn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
home: true
heroImage: /logo.png
actionText: 由此起步 →
actionLink: /zh-cn/guide/
features:
- title: 自动更新
details: 无需考虑更新 UI 或重新获取查询的问题!
- title: 模板内组件
details: 通过 Apollo 组件声明式地使用 Apollo
- title: 支持 SSR
details: 在渲染 HTML 页面之前在服务端运行你的查询
footer: LICENCE ISC - Created by Guillaume CHAU (@Akryum)
---

<p style="text-align: center;">
<a href="https://www.patreon.com/akryum" target="_blank">
<img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Become a Patreon">
</a>
</p>
7 changes: 7 additions & 0 deletions docs/zh-cn/api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# API 参考

欢迎查看 API 参考!

::: warning Work-in-Progress
如果你发现缺少了某些东西,请创建一个代码合并请求!
:::
23 changes: 23 additions & 0 deletions docs/zh-cn/api/apollo-mutation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# ApolloMutation 组件

## Props

- `mutation`:GraphQL 查询(由 `graphql-tag` 转换)
- `variables`:GraphQL 变量对象
- `optimisticResponse`:详见 [乐观 UI](https://www.apollographql.com/docs/react/features/optimistic-ui.html)
- `update`:详见 [变更后更新缓存](https://www.apollographql.com/docs/react/api/react-apollo.html#graphql-mutation-options-update)
- `refetchQueries`:详见 [变更后重新获取查询](https://www.apollographql.com/docs/react/api/react-apollo.html#graphql-mutation-options-refetchQueries)
- `clientId`:用于解析使用的 Apollo 客户端(在 ApolloProvider 中定义)
- `tag`:字符串,HTML 标签名(默认值:`div`);如果是 `undefined`,该组件将成为无渲染组件(内容不会被包装在标签中)

## 作用域插槽 props

- `mutate(options = undefined)`:调用变更的函数。你可以重载变更的选项(例如:`mutate({ variables: { foo: 'bar } })`)
- `loading`:布尔值,表明请求正在进行中
- `error`:最后一次变更调用的最终错误
- `gqlError`:第一个 GraphQL 错误(如果有)

## 事件

- `done(resultObject)`
- `error(errorObject)`
Loading