M
M
movsumlu2020-10-28 22:11:19
Vue.js
movsumlu, 2020-10-28 22:11:19

How to call a method in another VueJS component that is at the same level?

good evening, you need to call a method in another VueJS component, which is at the same level,
can you catch it correctly?
those. from a child, call a method using emit, catch it in the parent, and then pass it to another child?
ps the solution via vuex is not suitable in this case, alas

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-10-29
@movsumlu

component 1:

methods: {
  someMethod() {
    ...

component 2:
this.$emit('i-want-to-call-method-from-component-1');

parent:
<component-1 ref="component1" />
<component-2 @i-want-to-call-method-from-component-1="$refs.component1.someMethod()" />

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question