M
M
Morfeey2018-05-10 13:42:36
Vue.js
Morfeey, 2018-05-10 13:42:36

Trying to make a custom event, what's wrong?

There is an element on the page on which an attempt was made to hang an event on click and passing a parameter:

<div @click="$root.$emit('item-selected', [item, version])"></div>

In a vue instance not related to this element, trying to process it (the 'mounted' section):
this.$root.$on('item-selected', function (data) {
            console.log(data);
            Loader.Finish();
 });

Does not work. What can be wrong ? Newbie in vue, don't kick too much)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question