lazy modifier affect v-model updates?v-model.lazy. When does the component update its bound data compared to a normal v-model?<template> <input v-model.lazy="text" /> <p>{{ text }}</p> </template> <script setup> import { ref } from 'vue' const text = ref('') </script>
The lazy modifier delays updating the bound data until the input loses focus, which means the update happens on the change event instead of the input event.
number modifier have on v-model?v-model.number, what type will the bound data have after user input?<template> <input v-model.number="age" /> <p>{{ typeof age }}</p> </template> <script setup> import { ref } from 'vue' const age = ref('') </script>
The number modifier automatically converts the input string to a number type before updating the bound data.
v-model usage correctly trims whitespace from user input?v-model modifiers.v-model separated by dots.The trim modifier removes leading and trailing whitespace from the input before updating the bound data. It is used as v-model.trim.
v-model.number input not convert to a number?<template> <input v-model.number.lazy="score" /> <p>{{ typeof score }}</p> </template> <script setup> import { ref } from 'vue' const score = ref('') </script>
The lazy modifier delays the update until the input loses focus. The number modifier converts the value at update time, so the type remains string until blur.
v-model.lazy.number.trim modifiers on an input?v-model.lazy.number.trim on an input element.<template> <input v-model.lazy.number.trim="value" /> <p>{{ value }} ({{ typeof value }})</p> </template> <script setup> import { ref } from 'vue' const value = ref('') </script>
The lazy modifier delays update until blur, trim removes whitespace before update, and number converts the trimmed string to a number before updating the bound data.
