Vue.js—Difference between v-model and v-bind

前端 未结 5 813
小蘑菇
小蘑菇 2020-11-27 08:54

I\'m learning Vue with an online course and the instructor gave me an exercise to make an input text with a default value. I completed it using v-model but, the instructor c

5条回答
  •  孤街浪徒
    2020-11-27 09:33

    In simple words v-model is for two way bindings means: if you change input value, the bound data will be changed and vice versa.

    but v-bind:value is called one way binding that means: you can change input value by changing bound data but you can't change bound data by changing input value through the element.

    check out this simple example: https://jsfiddle.net/gs0kphvc/

提交回复
热议问题