Files
apollo/docs/zh-cn/guide/multiple-clients.md
T
高英健 906975e45b docs: Add Chinese Doc (#329)
* docs: structure of Chinese doc

* docs: translate root page to Chinese

* docs: translate pages in `/guide` and `/guid/apollo` to Chinese

* docs: translate pages in `/api` and `/migration` to Chinese

- fix some words in completed pages

* docs: translate pages in `/guide/components` to Chinese

* docs: fix some words

* docs: keep Chinese version up to date

* docs: Chinese version up to date

* docs: fix some words

* docs: fix some words
2018-09-08 15:53:04 +02:00

649 B

多客户端

如果你的应用需要连接到不同的 GraphQL 入口端点,你可以指定多个 apollo 客户端:

const apolloProvider = new VueApollo({
  clients: {
    a: apolloClient,
    b: otherApolloClient,
  },
  defaultClient: apolloClient,
})

在组件的 apollo 选项中,你可以使用 $client 为所有的查询、订阅和变更定义要使用的客户端(仅限在此组件内):

export default {
  apollo: {
    $client: 'b',
  },
}

你也可以在单个查询,订阅和变更的选项中使用 client 属性来指定客户端:

tags: {
  query: gql`...`,
  client: 'b',
}