V
V
Vladislav2020-08-03 18:19:47
Vue.js
Vladislav, 2020-08-03 18:19:47

What does $emit do in Vue.js?

I read the doc, read other articles, watched vidos, but I can’t understand exactly what $emit does and when should it be used?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Michael, 2020-08-04
@SlavaMaxwell

It simply fires an event that its parent component can subscribe to.
Note that these events do not "bubble" like js events, they are only for communication between two components. Which in practice will mean that if you need to transfer somewhere further, you need to issue it again, which is not very convenient.
But this is not much needed, because. all the same, everyone stores data in vuex, and does not drive data back and forth

A
Alexey Yarkov, 2020-08-03
@yarkov Vue.js

doku read

Yes, how so?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question