-
Notifications
You must be signed in to change notification settings - Fork 9
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
132.[vue]vue组件间通信六种方式(完整版) #132
Comments
方法一、props/$emit 1.父组件向子组件传值
总结:父组件通过props向下传递数据给子组件。注:组件中的数据共有三种形式:data、props、computed 子组件向父组件传值(通过事件形式)
方法二、$emit/$on 1.具体实现方式:
假设兄弟组件有三个,分别是A、B、C组件,C组件如何获取A或者B组件的数据
方法三、vuex Vuex实现了一个单向数据流,在全局拥有一个State存放数据,当组件要更改State中的数据时,必须通过Mutation进行,Mutation同时提供了订阅者模式供外部插件调用获取State数据的更新。而当所有异步操作(常见于调用后端接口异步获取更新数据)或批量的同步操作需要走Action,但Action也是无法直接修改State的,还是需要通过Mutation来修改State的数据。最后,根据State的变化,渲染到视图上。 Vue Components:Vue组件。HTML页面上,负责接收用户操作等交互行为,执行dispatch方法触发对应action进行回应。 3.Vuex与localStorage |
[vue]
The text was updated successfully, but these errors were encountered: