This is the scenarios. I have a Graph component that appears in the body of the page, where the user can make some changes.
I also have a Search component that appears in the header of the page.
The two are unrelated - Graph only appears in the body of this one page, while Search appears in the header of all pages. They belong to app.js, which is currently just this:
require('./bootstrap');
window.Vue = require('vue');
Vue.component('search', require('./components/Search').default);
Vue.component('graph', require('./components/Graph').default);
/* other components */
import PerfectScrollbar from 'vue2-perfect-scrollbar'
import 'vue2-perfect-scrollbar/dist/vue2-perfect-scrollbar.css'
Vue.use(PerfectScrollbar);
const app = new Vue({
el: '#app',
data : {
},
methods : {
},
mounted : function(){
},
computed : {
}
});
Now, when the user changes the data in Graph, I am supposed to send that change to Search. It doesn't really matter what the data is, I just need to figure out the sending process.
So, how do I send something from Graph to Search? I've been trying to emit the change, but I have no idea how to capture it in Search. I've used emit before with child/parent components, but I can't find documentation on how to do it here.
Logically, I think it should go through app.js somehow, but I can't find the appropriate syntax.