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

57.vuex 使用场景 #57

Open
wqjiao opened this issue May 12, 2020 · 0 comments
Open

57.vuex 使用场景 #57

wqjiao opened this issue May 12, 2020 · 0 comments

Comments

@wqjiao
Copy link
Owner

wqjiao commented May 12, 2020

  1. 解决两个问题

多个组件依赖于同一状态时,对于多层嵌套的组件的传参将会非常繁琐,并且对于兄弟组件间的状态传递无能为力。
来自不同组件的行为需要变更同一状态。以往采用父子组件直接引用或者通过事件来变更和同步状态的多份拷贝。以上的这些模式非常脆弱,通常会导致无法维护的代码。

  1. 当项目遇到以下两种场景时

多个组件依赖于同一状态时。
来自不同组件的行为需要变更同一状态。

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