1.Vue之v-model双向绑定、用侦听功能取反字符串
①v-model
v-model:**用来对 input、select、textarea、checkbox、radio等表单控件元素上创建双向数据绑定,根据表单上的值,自动更新绑定的元素的值。
<input type="text" v-model="msg">
<p>{
{msg}}<p>
<script>
new Vue({
el: '#app',
data: {
msg: '双向同步绑定',
}
})
</script>
②methods属性: 定义vue实例所有可用的方法。
例如:点按钮后触发像msg2的值=msg取值并计算的结果。
<input type="text" v-model="msg">
<input type="button" v-on:click="msgreverse" value="按钮事件" />
<p>双向绑定标签值:{
{msg}}<p>
<p>按钮 取值 结果:{
{msg2}