Skip to content

Commit 639dc49

Browse files
h7mlJinjiang
andauthored
docs(zh): 优化 API 文档格式和内容 (#2569)
* docs(zh): 优化 API 文档格式和内容 - 调整文档结构,优化标题层级 - 修正部分语法错误和排版问题 - 统一代码样式 * docs(.zh): 使用zhlint优化 API 文档格式和内容 - 调整段落间距和标点符号,提高可读性 - 统一使用冒号和空格分隔标题和内容 * docs(.zh): 更新全局挂载选项示例说明 - 在文档中明确全局模拟示例中的 $t 变量可能来自 vue-i18n * Update index.md --------- Co-authored-by: Jinjiang <[email protected]>
1 parent 12274c3 commit 639dc49

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/zh/api/index.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const wrapper = mount(Component, {
6060

6161
#### options.global
6262

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

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

1155-
`Component.spec.js`
1155+
`Component.spec.js`:
11561156

11571157
```js
11581158
import { mount } from '@vue/test-utils'
@@ -1163,7 +1163,7 @@ import Foo from '@/Foo.vue'
11631163
test('findComponent', () => {
11641164
const wrapper = mount(Component)
11651165
1166-
// All the following queries would return a VueWrapper
1166+
// 所有以下查询将返回一个 VueWrapper
11671167
11681168
wrapper.findComponent('.foo')
11691169
wrapper.findComponent('[data-test="foo"]')
@@ -1257,7 +1257,7 @@ import Component from './Component.vue'
12571257
test('findAllComponents', () => {
12581258
const wrapper = mount(Component)
12591259
1260-
// Returns an array of VueWrapper
1260+
// 返回一个 VueWrapper 数组
12611261
wrapper.findAllComponents('[data-test="number"]')
12621262
})
12631263
```
@@ -1363,7 +1363,7 @@ export default {
13631363
</script>
13641364
```
13651365

1366-
`Component.spec.js`
1366+
`Component.spec.js`:
13671367

13681368
```js
13691369
import { mount } from '@vue/test-utils'
@@ -1602,7 +1602,7 @@ export default {
16021602
</script>
16031603
```
16041604

1605-
`Component.spec.js`
1605+
`Component.spec.js`:
16061606

16071607
```js
16081608
import { mount } from '@vue/test-utils'
@@ -1852,7 +1852,7 @@ test('unmount', () => {
18521852
})
18531853
```
18541854

1855-
## Wrapper properties
1855+
## Wrapper 属性
18561856

18571857
### vm
18581858

@@ -1954,7 +1954,7 @@ type GlobalMountOptions = {
19541954

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

1957-
**Example :**
1957+
**示例:**
19581958

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

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

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

2017-
**Usage:**
2017+
**用法:**
20182018

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

20212021
```js
20222022
import { mount, RouterLinkStub } from '@vue/test-utils'

0 commit comments

Comments
 (0)