Answer the question
In order to leave comments, you need to log in
How to properly send form data to vue?
There is a form. With inputs and button values (to select delivery or pickup, to pay by card or cash, etc.). Linking inputs using v-model is understandable, but how to link to the value of the selected buttons?
Code snippet:
...
<div>
<input v-model="name" class="order_input" type="text" placeholder="Имя" >
</div>
...
<div v-if="cafeIsActive" class="select_type">
<p class="radio_p">Выберите кафе</p>
<div class="radio_btns">
<div class="form_radio_btn">
<input id="radio-5" type="radio" name="cafeID" value="cafe1" checked>
<label for="radio-5">Кафе 1</label>
</div>
<div class="form_radio_btn" >
<input id="radio-6" type="radio" name="cafeID" value="cafe2">
<label for="radio-6">Кафе 2</label>
</div>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
axios.post(url, this.$data)
axios.post(url, {
name: this.name,
foo: this.foo,
bar: this.bar
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question