[Vuejs]-How get a input value and send him to another component

0👍

I think that you should use the EventBus to solve your question.

in main.js

const bus = new Vue()
Vue.prototype.$bus = bus 

you can register an event listener

this.$bus.on( 'test', ( data ) => {
 console.log( 'test', data );
} );

and emit it

this.$bus.emit( 'test', { code: 1 } );

you also can look at https://github.com/yyued/hub.js

Leave a comment