S
S
Sergey Burduzha2021-04-28 23:12:57
Vue.js
Sergey Burduzha, 2021-04-28 23:12:57

How to call a method that takes event when props changes?

I want to implement validation.
Created an input component.
With the onBlur method, the value of the input is checked.

Now I want to implement so that when the button is clicked, props with a value of true are passed to the component, and the onBlur method needs to be called, but how to pass event in it?

I inserted jsfiddle, since there is no formatting for vue.

And mistake

6089c1b5dced3672245894.jpeg



Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MikUrrey, 2021-04-28
@serii81

Do better instead of passing an event:
<input ref="name" @blur="onBlur" ...

...
  onBlur() {
    const target = this.$refs.name
    ...
  }
...

and then everything should work

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question