Skip to content

Update reactivity.md #697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 3, 2018
Merged

Update reactivity.md #697

merged 3 commits into from
Apr 3, 2018

Conversation

dear-lizhihua
Copy link
Contributor

No description provided.

@Justineo
Copy link
Member

Justineo commented Apr 3, 2018

前一半 LGTM。

后面一半感觉原文挺清晰的呀?

@@ -70,7 +70,7 @@ var vm = new Vue({
vm.message = 'Hello!'
```

如果你在 data 选项中未声明 `message`,Vue 将警告你渲染函数在试图访问的属性不存在
如果你未在 data 选项中声明 `message`,Vue 会抛出向你一条警告:render 函数正在试图访问的一个属性,在实例中并不存在
Copy link
Member

Choose a reason for hiding this comment

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

“……Vue 将警告你渲染函数正在试图访问一个不存在的属性。”这样更好一些吗?
Btw. 这里原文的 render function 我觉得应该翻译成“渲染函数”,而不是特指 render 这个函数名。如果是后者的话,原文这里会用反引号括起来。
谢谢

Copy link
Contributor Author

@dear-lizhihua dear-lizhihua Apr 3, 2018

Choose a reason for hiding this comment

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

其实我想强调的是正在在实例 data 中,我修正一下。

@@ -70,7 +70,7 @@ var vm = new Vue({
vm.message = 'Hello!'
```

如果你在 data 选项中未声明 `message`,Vue 将警告你渲染函数在试图访问的属性不存在
如果你未在 data 选项中声明 `message`,Vue 将警告你渲染函数正在试图访问的属性在实例的 data 中不存在
Copy link
Member

Choose a reason for hiding this comment

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

加上 data 是不对的,因为 Vue 并不会知道你的数据会在 data/props/computed 中的哪一个。Vue 只能知道不存在。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

想了想这个案例是以 data 举例,说在实例的 data 中也是可以,不过想想还是改回原译吧。

@Jinjiang Jinjiang merged commit 4484656 into vuejs:master Apr 3, 2018
@dear-lizhihua dear-lizhihua deleted the patch-2 branch April 7, 2019 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants