-
Notifications
You must be signed in to change notification settings - Fork 846
fix: update reactivity-computed-wachers.md #50
Conversation
update 'watch' & 'watcheffect' translations with composition-api
|
||
当在组件的 [setup ()](composition-api-setup.html) 函数或[生命周期钩子](composition-api-lifecycle-hooks.html)期间调用 `watchEffect` 时,侦听器链接到组件的生命周期,并在组件卸载时自动停止。 | ||
当 `watchEffect` 在组件的 [setup()](composition-api-setup.html) 函数或[生命周期钩子](composition-api-lifecycle-hooks.html)被调用时, 侦听器会被链接到该组件的生命周期,并在组件卸载时自动停止。 |
There was a problem hiding this comment.
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` 钩子中进行: |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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`): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
更新了
watch
和watchEffect
的翻译这部分参考了composition-api中 watcheffect和watch的翻译