Pretty new to vue js here,
I just want to know if it is possible to issue a custom event from the main instance of vue (parent), and the components can listen to this custom event and act accordingly when this event is fired?
I want to fire a custom event in vive instance lifecycle mode mounted , then all components can initialize themselves.
ex.
The main instance of vue
new Vue( {
el : '#main-app',
mounted : function() {
this.$emit( 'init-app' );
}
} );
Then, on different components, it can listen to the custom 'init-app' event , and then act accordingly when it is triggered or emitted.
, vue js. html? ?
. vue js 2.0.3
,
.
Vue.component('my-component', {
template: '#component-template'
});
.
.