<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>v-model</title>
<script type="text/javascript" src="../assets/js/vue.js"></script>
</head>
<body>
<h1>v-model</h1>
<hr>
<div id="app">
双向数据绑定
<br>
<input type="text" v-model="info">
<br>
<input type="text" v-model.lazy="info">
lazy懒加载 等鼠标消失才显示
<br>
<input type="text" v-model.number="info">
number必须是数字
<br>
<input type="text" v-model.trim="info">
trim过滤
<br>
<p>{{info}}</p>
<h3>文本域</h3>
<textarea name="" id="" cols="30" rows="10" v-model="info"></textarea>
<h3>多选框绑定一个值</h3>
<input type="checkbox" id="isTrue" v-model="isTrue">
<label for="isTrue">{{isTrue}}</label>
<hr>
<h3>多选框绑定数组</h3>
<p>
<input type="checkbox" id="json" value="json" v-model="web_name">
<label for="json">json</label>
<input type="checkbox" id="whl" value="whl" v-model="web_name">
<label for="whl">whl</label>
<input type="checkbox" id="wl" value="wl" v-model="web_name">
<label for="wl">wl</label>
<p>{{web_name}}</p>
</p>
<hr>
<h3>单选框绑定</h3>
<p>
<input type="radio" id="one" value="男" v-model="sex">
<label for="one">男</label>
<input type="radio" id="two" value="女" v-model="sex">
<label for="two">女</label>
<p>你选择的性别是:{{sex}}</p>
</p>
</div>
</body>
</html>
<script>
var app = new Vue({
el:'#app',
data:{
info:'1',
isTrue:true,
web_name:[],
sex:'男'
}
})
</script>