Skip to content

Conversation

ikxin
Copy link
Contributor

@ikxin ikxin commented Sep 9, 2024

Description of Problem

vuejs/docs@3ba5add...6d4e543

dependabot bot and others added 30 commits August 20, 2024 13:34
Bumps [vue](https://github.com/vuejs/core) from 3.5.0-beta.1 to 3.5.0-beta.2.
- [Release notes](https://github.com/vuejs/core/releases)
- [Changelog](https://github.com/vuejs/core/blob/main/CHANGELOG.md)
- [Commits](vuejs/core@v3.5.0-beta.1...v3.5.0-beta.2)

---
updated-dependencies:
- dependency-name: vue
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…2971)

* chore: added a link to inheritAttrs option

* fix: fixed closing tag
Bumps [vitepress](https://github.com/vuejs/vitepress) from 1.3.2 to 1.3.4.
- [Release notes](https://github.com/vuejs/vitepress/releases)
- [Changelog](https://github.com/vuejs/vitepress/blob/main/CHANGELOG.md)
- [Commits](vuejs/vitepress@v1.3.2...v1.3.4)

---
updated-dependencies:
- dependency-name: vitepress
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [vue](https://github.com/vuejs/core) from 3.5.0-beta.2 to 3.5.0-rc.1.
- [Release notes](https://github.com/vuejs/core/releases)
- [Changelog](https://github.com/vuejs/core/blob/main/CHANGELOG.md)
- [Commits](vuejs/core@v3.5.0-beta.2...v3.5.0-rc.1)

---
updated-dependencies:
- dependency-name: vue
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Natalia Tepluhina <[email protected]>
docs: remarks about minor version (follow up to b6339b6)
Copy link

vercel bot commented Sep 9, 2024

@ikxin is attempting to deploy a commit to the vuejs Team on Vercel.

A member of the Team first needs to authorize it.

@ikxin
Copy link
Contributor Author

ikxin commented Sep 9, 2024

Vue 3.5 发布有一段时间了,我看到中文文档迟迟没有同步,所以我发起了这个 PR,翻译内容大部分是用了 ChatGPT,如有翻译不妥的地方还请指正,非常感谢

@ikxin
Copy link
Contributor Author

ikxin commented Sep 10, 2024

@KiritaniAyaka 感谢建议

Comment on lines 111 to 123
## 延迟水合 <sup class="vt-badge" data-text="3.5+" /> {#lazy-hydration}

> 如果你正在使用[服务器端渲染](/guide/scaling-up/ssr),这一部分才会适用。

在 Vue 3.5+ 中,异步组件可以通过提供水合策略来控制何时进行水合。

- Vue 提供了一些内置的水合策略。这些内置策略需要分别导入,以便在未使用时进行 tree-shaking。

- 这个设计有意为之,低级别以获得灵活性。将来编译器语法糖可能可以在核心或高级别解决方案(如 Nuxt)中构建在此基础之上。

### 在空闲时进行水合作用

通过 `requestIdleCallback` 进行水合作用:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 延迟水合 <sup class="vt-badge" data-text="3.5+" /> {#lazy-hydration}
> 如果你正在使用[服务器端渲染](/guide/scaling-up/ssr),这一部分才会适用
在 Vue 3.5+ 中,异步组件可以通过提供水合策略来控制何时进行水合
- Vue 提供了一些内置的水合策略。这些内置策略需要分别导入,以便在未使用时进行 tree-shaking。
- 这个设计有意为之,低级别以获得灵活性。将来编译器语法糖可能可以在核心或高级别解决方案(如 Nuxt)中构建在此基础之上
### 在空闲时进行水合作用
通过 `requestIdleCallback` 进行水合作用
## 延迟激活<sup class="vt-badge" data-text="3.5+" /> {#lazy-hydration}
> 这部分仅当你正在使用[服务端渲染](/guide/scaling-up/ssr)才适用
在 Vue 3.5+ 中,异步组件可以通过提供激活策略来控制何时进行激活
- Vue 提供了一些内置的激活策略。这些内置策略需要分别导入,以便在未使用时进行 tree-shaking。
- 该设计有意采用低级设计以提高灵活性。未来不论是核心还是更高级的解决方案(如 Nuxt)的编译器语法糖将可能在此基础上构建
### 空闲时激活
通过 `requestIdleCallback` 激活

Comment on lines 134 to 136
### 在可见时水合

当元素通过 `IntersectionObserver` 变为可见时进行水合。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### 在可见时水合
当元素通过 `IntersectionObserver` 变为可见时进行水合
### 可见时激活
借助 `IntersectionObserver`,当元素可见时激活

Comment on lines 153 to 155
### 在媒体查询匹配时进行水合作用

当指定的媒体查询匹配时进行水合作用。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### 在媒体查询匹配时进行水合作用
当指定的媒体查询匹配时进行水合作用
### 媒体查询匹配时激活
当指定的媒体查询匹配时激活

Comment on lines 166 to 168
### 交互时水合

当组件元素上触发指定事件时进行水合。完成水合后,触发水合的事件也将被重新播放。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### 交互时水合
当组件元素上触发指定事件时进行水合。完成水合后,触发水合的事件也将被重新播放
### 交互时激活
当组件元素上触发指定事件时激活。触发激活的事件将在完毕后重放

id(newId, oldId, onCleanup) {
// ...
onCleanup(() => {
// cleanup logic
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// cleanup logic
// 清理逻辑

@@ -360,6 +371,17 @@ const foo = inject('foo') as string

## 为模板引用标注类型 {#typing-template-refs}

使用 Vue 3.5 和 `@vue/language-tools` 2.1(为 IDE 语言服务和 `vue-tsc` 提供支持),在单文件组件中,`useTemplateRef()` 创建的 ref 类型可以根据匹配的 `ref` 属性使用的元素**自动推断**为静态 ref。

在无法进行自动推断的情况下,仍然可以通过通用参数将模板 ref 转换为显式类型。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
在无法进行自动推断的情况下,仍然可以通过通用参数将模板 ref 转换为显式类型
在无法自动推断的情况下 (如非 SFC 使用或动态组件),仍然可以通过泛型参数将模板 ref 强制转换为显式类型

```

为了获取 `MyModal` 的类型,我们首先需要通过 `typeof` 得到其类型,再使用 TypeScript 内置的 `InstanceType` 工具类型来获取其实例类型:
为了获取导入组件的实例类型,我们需要先通过 `typeof` 获取其类型,然后使用 TypeScript 的内置 `InstanceType` 实用程序提取其实例类型:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
为了获取导入组件的实例类型,我们需要先通过 `typeof` 获取其类型,然后使用 TypeScript 的内置 `InstanceType` 实用程序提取其实例类型
为了获取导入组件的实例类型,我们需要先通过 `typeof` 获取其类型,然后使用 TypeScript 的内置 `InstanceType` 工具类型提取其实例类型

@Justineo Justineo added 从英文版同步 请使用 merge commit 合并 从 upstream 同步的 PR 需保留 git 历史记录 labels Sep 10, 2024
@Justineo Justineo merged commit c398bc1 into vuejs-translations:main Sep 10, 2024
4 of 5 checks passed
@ikxin ikxin deleted the translate branch September 19, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
从英文版同步 请使用 merge commit 合并 从 upstream 同步的 PR 需保留 git 历史记录
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants