Skip to content
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

inject 选项的初始化及实现,有一段描述不准确 #319

Open
longqizhu opened this issue Nov 30, 2021 · 0 comments
Open

inject 选项的初始化及实现,有一段描述不准确 #319

longqizhu opened this issue Nov 30, 2021 · 0 comments

Comments

@longqizhu
Copy link

QQ截图20211130165606

我在学习这部分的内容,看到这里,觉得描述不准确。
我的看法如下

provide 和 inject 绑定不是可响应的,并不是因为 函数关闭了响应式定义的开关。开关关闭了,只是不做深度响应,表层还是响应的。
真正原因是 provide 初始化时,并没有做响应式处理。
所以如果 provide 提供的数据本身不是响应式,就不会触发 inject 的表层响应。
inject 关闭开关,真正起到的作用是避免依赖的重复收集。

以上是我的看法,如果错了请指正。
以及,文档很棒。

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

No branches or pull requests

1 participant