P
P
Pavel Beloborodov2021-07-28 15:19:27
Vue.js
Pavel Beloborodov, 2021-07-28 15:19:27

How does alert.$emit("test-name", this.options) work?

I make changes to the project and see this code

selectLanguageOption(data) {
      if (data === 'interface') {
        alert.$emit('langChange', this.activeLang)
      }
    },

With my mind, I kind of understand that the "langChange" event is called from the parent and some data is being transmitted. Why via alert and there is no such event in the parent component.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Belyaev, 2021-07-28
@bingo347

The event is called directly on the alert, and what this alert is is not clear from this piece of code, but most likely it is not a parent

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question