[Vuejs]-How to call a function from one vue file to another vue file in vue js

1๐Ÿ‘

โœ…

If these two components are in a parent-child relation then you can use $emit from a child component to a parent one and use $refs. to call a child component method directly from a parent component.

If these components are not related closely then you should use the event bus pattern (see examles with creating new Vue()) or if you wish shared data for these components then use a vuex store to store all shared objects.

๐Ÿ‘คAnatoly

Leave a comment