Files
apollo/docs/zh-cn/api/smart-subscription.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

920 B

智能订阅

每个在组件中的 apollo.$subscribe 选项中声明的订阅都会创建一个智能订阅对象。

选项

  • query:GraphQL 文档(可以是一个文件或一个 gql 字符串)。
  • variables:对象或返回对象的响应式函数。每个键将用 '$' 映射到 GraphQL 文档中,例如 foo 将变为 $foo
  • throttle:变量更新节流时间(毫秒)。
  • debounce:变量更新防抖时间(毫秒)。
  • result(data) 是收到结果时调用的钩子。

属性

Skip

你可以使用 skip 来暂停或停止暂停:

this.$apollo.subscriptions.users.skip = true

方法

refresh

停止并重新启动查询:

this.$apollo.subscriptions.users.restart()

start

开始查询:

this.$apollo.subscriptions.users.start()

stop

停止查询:

this.$apollo.subscriptions.users.stop()