From c71573dd32a05e87d367dca9b6f0862420195a88 Mon Sep 17 00:00:00 2001 From: h7ml Date: Wed, 18 Dec 2024 13:06:26 +0800 Subject: [PATCH 1/4] =?UTF-8?q?docs(zh):=20=E4=BC=98=E5=8C=96=20API=20?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E6=A0=BC=E5=BC=8F=E5=92=8C=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整文档结构,优化标题层级 - 修正部分语法错误和排版问题 - 统一代码样式 --- docs/zh/api/index.md | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/docs/zh/api/index.md b/docs/zh/api/index.md index 93337218a..15af22195 100644 --- a/docs/zh/api/index.md +++ b/docs/zh/api/index.md @@ -60,10 +60,10 @@ const wrapper = mount(Component, { #### options.global -组件状态中,你可以通过 [`MountingOptions.global` 配置属性](#global)配置上述 Vue 3 应用程序。这对于提供组件期望可用的模拟值非常有用。 +在组件状态中,你可以通过 [`MountingOptions.global` 配置属性](#global) 配置上述 Vue 3 应用程序。这对于提供组件期望可用的模拟值非常有用。 ::: tip -如果你发现自己需要为许多测试设置共同的应用配置,则可以使用导出的 [`config` 对象](#config)为整个测试套件设置配置。 +如果你发现自己需要为许多测试设置共同的应用配置,则可以使用导出的 [`config` 对象](#config) 为整个测试套件设置配置。 ::: ### attachTo @@ -1152,7 +1152,7 @@ export default { ``` -`Component.spec.js` +`Component.spec.js`: ```js import { mount } from '@vue/test-utils' @@ -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"]') @@ -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"]') }) ``` @@ -1363,7 +1363,7 @@ export default { ``` -`Component.spec.js` +`Component.spec.js`: ```js import { mount } from '@vue/test-utils' @@ -1602,7 +1602,7 @@ export default { ``` -`Component.spec.js` +`Component.spec.js`: ```js import { mount } from '@vue/test-utils' @@ -1852,7 +1852,7 @@ test('unmount', () => { }) ``` -## Wrapper properties +## Wrapper 属性 ### vm @@ -1954,9 +1954,7 @@ type GlobalMountOptions = { 你可以选择在整个测试套件中配置挂载选项,而不是在每个测试中单独配置。这些配置将在每次 `mount` 组件时默认使用。如果需要,你可以在每个测试中覆盖这些默认设置。 -**Example :** - -全局模拟来可能是自 vue-i18n 的 `$t` 变量和一个组件: +**示例:** 全局模拟 `$t` 变量和一个组件: `Component.vue`: @@ -2014,9 +2012,9 @@ test('config.global mocks and stubs', () => { 你可以使用此组件在渲染树中查找 `router-link` 组件。 -**Usage:** +**用法:** -在挂载选项中设置为替换组件 (stub): +在挂载选项中设置为替代组件: ```js import { mount, RouterLinkStub } from '@vue/test-utils' From aa2181a018e091918618b8300e8c3550100fbdd2 Mon Sep 17 00:00:00 2001 From: h7ml Date: Wed, 18 Dec 2024 13:13:20 +0800 Subject: [PATCH 2/4] =?UTF-8?q?docs(.zh):=20=E4=BD=BF=E7=94=A8zhlint?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20API=20=E6=96=87=E6=A1=A3=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=92=8C=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整段落间距和标点符号,提高可读性 - 统一使用冒号和空格分隔标题和内容 --- docs/zh/api/index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/zh/api/index.md b/docs/zh/api/index.md index 15af22195..180e281eb 100644 --- a/docs/zh/api/index.md +++ b/docs/zh/api/index.md @@ -60,10 +60,10 @@ const wrapper = mount(Component, { #### options.global -在组件状态中,你可以通过 [`MountingOptions.global` 配置属性](#global) 配置上述 Vue 3 应用程序。这对于提供组件期望可用的模拟值非常有用。 +在组件状态中,你可以通过 [`MountingOptions.global` 配置属性](#global)配置上述 Vue 3 应用程序。这对于提供组件期望可用的模拟值非常有用。 ::: tip -如果你发现自己需要为许多测试设置共同的应用配置,则可以使用导出的 [`config` 对象](#config) 为整个测试套件设置配置。 +如果你发现自己需要为许多测试设置共同的应用配置,则可以使用导出的 [`config` 对象](#config)为整个测试套件设置配置。 ::: ### attachTo @@ -1954,7 +1954,7 @@ type GlobalMountOptions = { 你可以选择在整个测试套件中配置挂载选项,而不是在每个测试中单独配置。这些配置将在每次 `mount` 组件时默认使用。如果需要,你可以在每个测试中覆盖这些默认设置。 -**示例:** 全局模拟 `$t` 变量和一个组件: +**示例:**全局模拟 `$t` 变量和一个组件: `Component.vue`: From 7ed01b17d16cc99172f08afe5f2824f4ab8e9ad6 Mon Sep 17 00:00:00 2001 From: h7ml Date: Mon, 30 Dec 2024 09:14:37 +0800 Subject: [PATCH 3/4] =?UTF-8?q?docs(.zh):=20=E6=9B=B4=E6=96=B0=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E6=8C=82=E8=BD=BD=E9=80=89=E9=A1=B9=E7=A4=BA=E4=BE=8B?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在文档中明确全局模拟示例中的 $t 变量可能来自 vue-i18n --- docs/zh/api/index.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/zh/api/index.md b/docs/zh/api/index.md index 180e281eb..b929d0101 100644 --- a/docs/zh/api/index.md +++ b/docs/zh/api/index.md @@ -1954,7 +1954,10 @@ type GlobalMountOptions = { 你可以选择在整个测试套件中配置挂载选项,而不是在每个测试中单独配置。这些配置将在每次 `mount` 组件时默认使用。如果需要,你可以在每个测试中覆盖这些默认设置。 -**示例:**全局模拟 `$t` 变量和一个组件: +**Example :** + +全局模拟来可能是自 vue-i18n 的 `$t` 变量和一个组件: + `Component.vue`: From 6bef681e49281d41ec9a97b8f07aaf35752ece57 Mon Sep 17 00:00:00 2001 From: Jinjiang Date: Mon, 30 Dec 2024 11:02:16 +0800 Subject: [PATCH 4/4] Update index.md --- docs/zh/api/index.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/zh/api/index.md b/docs/zh/api/index.md index b929d0101..e99162693 100644 --- a/docs/zh/api/index.md +++ b/docs/zh/api/index.md @@ -1954,11 +1954,10 @@ type GlobalMountOptions = { 你可以选择在整个测试套件中配置挂载选项,而不是在每个测试中单独配置。这些配置将在每次 `mount` 组件时默认使用。如果需要,你可以在每个测试中覆盖这些默认设置。 -**Example :** +**示例:** 全局模拟来可能是自 vue-i18n 的 `$t` 变量和一个组件: - `Component.vue`: ```vue