I have two Vue components:
Vue.component(\'A\', {});
Vue.component(\'B\', {});
How can I access component A from component B? How does the
Communicate between two Vuejs components has many options. If your components are parent and child then you should use "props" to send data from parent to child and use "events" to communicate from child to parent. If your components are sibling then you need to use "store" else you can use "$root" property.
Parent to child
parent component
child component must have property
props: ['propsData']
Child to Parent
child component
this.$emit('messegeToParent', arg1, arg2, ...);
parent component
The below method should be in child component
messageReceivedFromChild(arg1, arg2, ...) {
}
Sibling components
component 1
this.$root.$emit('message1', arg1, arg2, ...);
component 2
this.$root.$on('message1', (arg1, arg2, ...) => {
});