A
A
Alex Smith2017-08-25 15:59:39
JavaScript
Alex Smith, 2017-08-25 15:59:39

How to call a method from another component in vue.js?

There are two components, in the first component I want to call a method from the second one, how to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2017-08-25
@Sanasol

Or cut global functions like services or cut vuex and share state between components.
Since you don't need to write, it goes against all patterns in general.

E
Evgeny Kulakov, 2017-08-25
@kulakoff Vue.js

In the template, assign a ref to the component whose method you want to call, further in the code:
If the task is simply to call some common functions, then there are plugins, mixins, directives for this - use what is better / more convenient in a particular case.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question