Sobes.tech
Middle

What modifiers exist for v-model?

sobes.tech AI

Answer from AI

v-model has three main modifiers:

  • .lazy: Updates the data after the change event instead of input.
  • .number: Converts the entered value to a number if possible.
  • .trim: Removes spaces at the beginning and end of the entered value.

Example usage:

<!-- .lazy: The value updates on the change event -->
<input v-model.lazy="message" />

<!-- .number: The value is converted to a number -->
<input v-model.number="age" type="number" />

<!-- .trim: Spaces at the edges of the value are removed -->
<input v-model.trim="username" />