Skip to content

Commit f316c50

Browse files
committed
docs: translate todos
1 parent 7a63b05 commit f316c50

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/api/options-lifecycle.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,12 @@
214214
- 如果 `errorCaptured` 钩子本身抛出了一个错误,那么这个错误和原来捕获到的错误都将被发送到 `app.config.errorHandler`
215215

216216
- `errorCaptured` 钩子可以通过返回 `false` 来阻止错误继续向上传递。即表示“这个错误已经被处理了,应当被忽略”,它将阻止其他的 `errorCaptured` 钩子或 `app.config.errorHandler` 因这个错误而被调用。
217-
<!-- TODO: translation -->
218-
**Error Capturing Caveats**
219-
220-
- In components with async `setup()` function (with top-level `await`) Vue **will always** try to render component template, even if `setup()` throwed error. This will likely cause more errors because during render component's template might try to access non-existing properties of failed `setup()` context. When capturing errors in such components, be ready to handle errors from both failed async `setup()` (they will always come first) and failed render process.
221217

222-
- <sup class="vt-badge" data-text="SSR only"></sup> Replacing errored child component in parent component deep inside `<Suspense>` will cause hydration mismatches in SSR. Instead, try to separate logic that can possibly throw from child `setup()` into separate function and execute it in the parent component's `setup()`, where you can safely `try/catch` the execution process and make replacement if needed before rendering the actual child component.
218+
**错误捕获注意事项**
219+
220+
- 在使用异步 `setup()` 函数(使用了顶层 `await`)的组件中,即使 `setup()` 抛出了错误,Vue 也会尝试渲染组件模板。这可能会导致更多错误,因为在渲染组件模板时,可能会尝试访问失败的 `setup()` 上下文中不存在的属性。当捕获这类组件的错误时,应当同时准备好捕获异步 `setup()`(永远会先抛出错误)和失败的渲染过程中的错误。
221+
222+
- <sup class="vt-badge" data-text="SSR only"></sup> 在 `<Suspense>` 的父组件中替换出错的子组件会导致 SSR 的激活不匹配。相反,尽量将可能抛出错误的逻辑从子组件的 `setup()` 中抽成一个独立的函数并在父组件的 `setup()` 中执行,这样就可以安全地 `try/catch` 执行过程,并在渲染实际的子组件前根据需要进行替换。
223223

224224
## renderTracked <sup class="vt-badge dev-only" /> {#rendertracked}
225225

src/guide/extras/render-function.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,8 @@ const vnode = withDirectives(h('div'), [
705705
### 模板引用 {#template-refs}
706706

707707
<div class="composition-api">
708-
<!-- TODO: translation -->
709-
With the Composition API, when using [`useTemplateRef()`](/api/composition-api-helpers#usetemplateref) <sup class="vt-badge" data-text="3.5+" /> template refs are created by passing the string value as prop to the vnode:
708+
709+
在组合式 API 中使用 [`useTemplateRef()`](/api/composition-api-helpers#usetemplateref) <sup class="vt-badge" data-text="3.5+" /> 时,模板引用是通过将字符串值作为 prop 传递给 vnode 创建的:
710710

711711
```js
712712
import { h, useTemplateRef } from 'vue'
@@ -722,9 +722,9 @@ export default {
722722
```
723723

724724
<details>
725-
<summary>Usage before 3.5</summary>
725+
<summary>3.5 之前的用法</summary>
726726

727-
In versions before 3.5 where useTemplateRef() was not introduced, template refs are created by passing the ref() itself as a prop to the vnode:
727+
3.5 版本之前 useTemplateRef() 暂未引入,模板引用是通过将 ref() 本身作为 prop 传递给 vnode 创建的:
728728

729729
```js
730730
import { h, ref } from 'vue'

0 commit comments

Comments
 (0)