S
S
Swartex2019-06-29 21:38:12
JavaScript
Swartex, 2019-06-29 21:38:12

Explain why this code works?

There is a custom select . I take it as practice. But in the process of parsing the code, only one incomprehensible construction remains for me, namely, in the selectValue function, which is triggered when an option is clicked. It calls But at the same time, this event is not listened to anywhere ... and in turn, the custom select works correctly. If the element on which the input event was fired was a simple input, there would be no confusion, but since this is a div, there was confusion ... Explain why it fires on a div`e ?
this.$emit("input", option);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lavezzi1, 2019-06-29
@Swartex

The input event is needed to work with v-model. You can call it how you want and on anything you want.
https://ru.vuejs.org/v2/guide/components.html#%D0%...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question