Vue.js / Nuxt.js

Vue Forms & Validation

v-model, form handling, input types, form validation, VeeValidate, Zod, Yup, custom validators

20 pytań z rozmów·
Mid-Level
1

What is v-model in Vue?

Odpowiedź

v-model creates a two-way binding between a form element and reactive data. It automatically synchronizes the input value with the associated variable, eliminating the need to manually write value binding and event listeners. This directive is the standard way to handle forms in Vue.

2

What is the equivalent of v-model using v-bind and an event listener?

Odpowiedź

v-model is syntactic sugar for the combination of v-bind:value (or :value) which binds the value and @input which listens for changes. This combination helps understand how v-model works internally and is useful when finer control over updates is needed.

3

Which v-model modifier should be used to synchronize the value only after the user leaves the field?

Odpowiedź

The .lazy modifier changes v-model behavior to listen to the change event instead of input. Synchronization happens on blur rather than on every keystroke. This is useful to reduce frequent updates and improve performance on fields with expensive validation.

4

Which v-model modifier automatically converts the input to a number?

5

How does v-model work with a single checkbox?

+17 pytań z rozmów

Opanuj Vue.js / Nuxt.js na następną rozmowę

Uzyskaj dostęp do wszystkich pytań, flashcards, testów technicznych, ćwiczeń code review i symulatorów rozmów.

Zacznij za darmo