Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
Dose the 'v-model' do something more in Vue2?
<template>
  <div>
    value: {{ obj.c }}
    <my-input v-model="obj.c"/>
    <my-input :value="obj.c" @change="(val) => (obj.c = val)"/>
  </div>
<template>

<script>
export default {
  data(){
    return {
      obj: {}
    }
  }
}
</script>

my-input is a customer component. v-model will update the View, but the other will not. These two methods are inequivalence ? What else did the 'v-model' do ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

v-model is a two-way data binding attribute for form inputs and :value is a one-way data binding attribute which binds a JavaScript value into the template and to update the value we can use v-on:input in addition to :value.

Demo :

new Vue({
  el: '#app',
  data: {
    vModelMessage: 'Hello Vue.js!',
    valueMessage: 'Hello Vue.js!'
  }
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
  <input type="text" v-model="vModelMessage"/>
  {{ vModelMessage }}
  <br><br>
  <input type="text" :value="valueMessage" v-on:input="valueMessage = $event.target.value"/>
  {{ valueMessage }}
</div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!