Skip to content

docs(zh): 优化 API 文档格式和内容 #2569

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

Merged
merged 4 commits into from
Dec 30, 2024
Merged
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
20 changes: 10 additions & 10 deletions docs/zh/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const wrapper = mount(Component, {

#### options.global

组件状态中,你可以通过 [`MountingOptions.global` 配置属性](#global)配置上述 Vue 3 应用程序。这对于提供组件期望可用的模拟值非常有用。
在组件状态中,你可以通过 [`MountingOptions.global` 配置属性](#global)配置上述 Vue 3 应用程序。这对于提供组件期望可用的模拟值非常有用。

::: tip
如果你发现自己需要为许多测试设置共同的应用配置,则可以使用导出的 [`config` 对象](#config)为整个测试套件设置配置。
Expand Down Expand Up @@ -1152,7 +1152,7 @@ export default {
</script>
```

`Component.spec.js`
`Component.spec.js`:

```js
import { mount } from '@vue/test-utils'
Expand All @@ -1163,7 +1163,7 @@ import Foo from '@/Foo.vue'
test('findComponent', () => {
const wrapper = mount(Component)

// All the following queries would return a VueWrapper
// 所有以下查询将返回一个 VueWrapper

wrapper.findComponent('.foo')
wrapper.findComponent('[data-test="foo"]')
Expand Down Expand Up @@ -1257,7 +1257,7 @@ import Component from './Component.vue'
test('findAllComponents', () => {
const wrapper = mount(Component)

// Returns an array of VueWrapper
// 返回一个 VueWrapper 数组
wrapper.findAllComponents('[data-test="number"]')
})
```
Expand Down Expand Up @@ -1363,7 +1363,7 @@ export default {
</script>
```

`Component.spec.js`
`Component.spec.js`:

```js
import { mount } from '@vue/test-utils'
Expand Down Expand Up @@ -1602,7 +1602,7 @@ export default {
</script>
```

`Component.spec.js`
`Component.spec.js`:

```js
import { mount } from '@vue/test-utils'
Expand Down Expand Up @@ -1852,7 +1852,7 @@ test('unmount', () => {
})
```

## Wrapper properties
## Wrapper 属性

### vm

Expand Down Expand Up @@ -1954,7 +1954,7 @@ type GlobalMountOptions = {

你可以选择在整个测试套件中配置挂载选项,而不是在每个测试中单独配置。这些配置将在每次 `mount` 组件时默认使用。如果需要,你可以在每个测试中覆盖这些默认设置。

**Example :**
**示例:**

全局模拟来可能是自 vue-i18n 的 `$t` 变量和一个组件:

Expand Down Expand Up @@ -2014,9 +2014,9 @@ test('config.global mocks and stubs', () => {

你可以使用此组件在渲染树中查找 `router-link` 组件。

**Usage:**
**用法:**

在挂载选项中设置为替换组件 (stub)
在挂载选项中设置为替代组件

```js
import { mount, RouterLinkStub } from '@vue/test-utils'
Expand Down
Loading