I use a bus to allow components to interact with other components using the method described in this link: https://forum.vuejs.org/t/create-event-bus-in-webpack-template/4546/2 .
I have a method that is called in a created hook that uses a bus to dispatch an event.
created () { this.getReviewDeck() }, myMethod () { bus.$emit('increment') }
In another component (which is contained in the above component) I attach an event listener to the created hook, as shown below:
created () { bus.$on('increment', this.incrementCount) }, incrementCount () { console.log('count incremented') }
, , " " . , , " " , , ..
, , , , , .
.
beforeDestroy () { EventBus.$off('increment', this.incrementCount) },
$.once
created () { bus.$once('increment', this.incrementCount) },
, . , , : , - . $ . , , $ on, , .
;
this.$eventBus.$emit("SHOW_HOVERLINE", d);
this.$eventBus.$on("SHOW_HOVERLINE", this.someFunction);
Source: https://habr.com/ru/post/1667907/More articles:Format data time series for short-term forecasting using repetitive neural networks - rHow to return the third largest number in an array - arraysError handling when waiting for an argument - pythonRegister ASP.NET MVC - c #How to find the index of the second largest element in my array? - arraysPage selection and identification - htmlHow to get a full explanation of Elasticsearch Java query? - javaInsert values ββfrom a DataFrame into another data frame - pythonThe command is invalid: always run a request to create a project - aureliaBest practice for changing route (VueRouter) after mutation (Vuex) - vue.jsAll Articles