Vue.js one-way binding forms

浪子不回头ぞ 提交于 2020-01-24 02:57:27

问题


I'm new with Vue.js and I'm trying to test some features of this framework. Now I'm testing the input forms, and I would like to make a one-way binding, without using the v-model directive, but I can't find any example. Anyone could help me, please?


回答1:


Here is example of one way and two way binding

var V = new Vue({
  el:'#vue-instance',
  data:{
    name:'Niklesh'
  }
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.4/vue.js"></script>
<div id="vue-instance">
<div>One Way binding with input box <input type="text" :value="name"></div>
<div>One Way binding as text {{name}}</div>

<div>Two way binding : <input type="text" v-model="name"></div>
</div>


来源:https://stackoverflow.com/questions/47349002/vue-js-one-way-binding-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!