Skip to content

docs: Add missing Chinese description #1592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: v4
Choose a base branch
from
Open
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
27 changes: 27 additions & 0 deletions packages/docs/src/zh-cn/api/use-lazy-query.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# useLazyQuery(延迟查询)

继承自 [useQuery](./use-query.md)

## 额外返回值(Additional Return)

* `load(document?, variables?, options?)`:一个用于启动查询的函数。如果是**第一次调用该查询**,它将返回 `Promise<Result>`;否则返回 `false`。

### 示例:

```js
const { load, refetch } = useLazyQuery(query, variables, options)

function fetchOrRefetch() {
load() || refetch()
}

async function waitForLoad() {
try {
const result = await load()
// 使用 result 做一些处理
}
catch (error) {
// 错误处理
}
}
```