Vue.js / Nuxt.js

Vue Forms & Validation

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

20 คำถามสัมภาษณ์·
Mid-Level
1

What is v-model in Vue?

คำตอบ

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?

คำตอบ

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?

คำตอบ

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 คำถามสัมภาษณ์

เชี่ยวชาญ Vue.js / Nuxt.js สำหรับการสัมภาษณ์ครั้งถัดไป

เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์

เริ่มใช้ฟรี