-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[vue] 有用过vuex吗?它主要解决的是什么问题?推荐在哪些场景用? #384
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
Comments
我主要还是当全局变量来用的,比如登录人信息、token、浏览记录、跨组件的较大临时数据传递。 |
解决的问题: |
主要解决: |
解决两个问题 多个组件依赖于同一状态时,对于多层嵌套的组件的传参将会非常繁琐,并且对于兄弟组件间的状态传递无能为力。 什么时候用Vuex? 当项目遇到以下两种场景时 多个组件依赖于同一状态时。 |
总结:
|
多个组件共享同一个状态。 |
[vue] 有用过vuex吗?它主要解决的是什么问题?推荐在哪些场景用?
The text was updated successfully, but these errors were encountered: