The pit stepped on by collecting form data in vue (daily learning record)

In our usual development, we should often encounter the collection of form data

Next, I will talk about the simplest case, which is also a case I learned, as a record,

In fact, when we collect the <input type="text"> input box of the account, it is best to collect it. Define a variable in data to receive the value of v-model

Then my trim here is the modifier of v-model. The trim modifier means to filter the first and last spaces.

When we collect age, all we collect are strings, what we want are numbers

What should we do , that is, add the modifier number after the v-model, so that what we collect is the number

Next, what should we do when we are going to collect the <input type="radio"> radio button

If we directly collect the value of the radio button, then the collected data can only be null

We need to add a value to the radio button so that the value can be collected if it is different.

 The following is the collection of check boxes

 

Guess you like

Origin blog.csdn.net/qq_25972233/article/details/125095555