Vue.js单向绑定形式 [英] Vue.js one-way binding forms
本文介绍了Vue.js单向绑定形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Vue.js的新手,正在尝试测试此框架的某些功能.
现在,我正在测试输入表单,并且我想在不使用v-model
指令的情况下进行单向绑定,但是找不到任何示例.有人可以帮助我吗?
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?
推荐答案
以下是单向绑定和双向绑定的示例
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>
这篇关于Vue.js单向绑定形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文