Answer the question
In order to leave comments, you need to log in
Submitting a form after changing data in Vue.js?
There is a form:
<form ref="form" method="POST">
<input type="text" :value="name">
</form>
<a href="#" @click.prevent="submit('Вася')">Инициирует отправку формы</a>
{
data{
name: '',
},
methods:{
submit(name){
this.name = name;
// форма отправляется до того, как изменится value инпута
this.$refs.form.submit();
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question