Vue.js / Nuxt.js

Vue Forms & Validation

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

20 câu hỏi phỏng vấn·
Mid-Level
1

What is v-model in Vue?

Câu trả lời

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?

Câu trả lời

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?

Câu trả lời

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 câu hỏi phỏng vấn

Nắm vững Vue.js / Nuxt.js cho lần phỏng vấn tiếp theo

Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.

Bắt đầu miễn phí