问题
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