Skip to content
This repository has been archived by the owner on Aug 8, 2022. It is now read-only.

fix: update reactivity-computed-wachers.md #50

Merged
merged 5 commits into from
Sep 15, 2020
Merged

Conversation

ajycc20
Copy link
Contributor

@ajycc20 ajycc20 commented Sep 15, 2020

更新了 watchwatchEffect的翻译

这部分参考了composition-api中 watcheffectwatch的翻译

update 'watch' & 'watcheffect' translations with composition-api
@ajycc20 ajycc20 changed the title fix: update reactivity-compoted-wachers.md fix: update reactivity-computed-wachers.md Sep 15, 2020

当在组件的 [setup ()](composition-api-setup.html) 函数或[生命周期钩子](composition-api-lifecycle-hooks.html)期间调用 `watchEffect` 时,侦听器链接到组件的生命周期,并在组件卸载时自动停止。
当 `watchEffect` 在组件的 [setup()](composition-api-setup.html) 函数或[生命周期钩子](composition-api-lifecycle-hooks.html)被调用时, 侦听器会被链接到该组件的生命周期,并在组件卸载时自动停止。
Copy link
Member

Choose a reason for hiding this comment

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

被调用时, 侦听器会被链接 多了个空格。


注意,第一次执行是在组件 mounted 之前的。因此,如果你希望在侦听效果下访问 DOM (或者模版 ref ),请在 mounted 钩子中执行
请注意,初始化运行是在组件 `mounted` 之前执行的。因此,如果你希望在编写副作用函数时访问 DOM(或模板 ref,请在 `onMounted` 钩子中进行
Copy link
Member

Choose a reason for hiding this comment

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

原文是:Note the first run is executed before the component is mounted. So if you wish to access the DOM (or template refs) in a watched effect, do it in the mounted hook:

这里 反单引号 的使用,应该遵从原版的翻译。(如果英文版有误,则需要给英文版发起 PR 后,中文版才会 merge)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

以上内容均已修改,英文版的 pr 已经合并

@@ -132,7 +134,7 @@ onMounted(() => {
})
```

在需要同步或在组件更新之前重新运行侦听器效果的情况下,我们可以使用 `flush` 选项传递一个附加的 `options` 对象 (默认为 `post`)
如果副作用需要同步或在组件更新之前重新运行,我们可以传递一个拥有 `flush` 属性的对象作为`options`默认为 `post`
Copy link
Member

@veaba veaba Sep 15, 2020

Choose a reason for hiding this comment

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

这里有英文与中文之间的空格问题。

属性的对象作为options(默认为 post):

参照:如何使用 zhlint 处理

@veaba veaba merged commit beeab24 into vuejs:master Sep 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants