v-model双向绑定
【摘要】
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>VUE绑定模式</title> <script src="js/vue.js"><...
-
<!DOCTYPE html>
-
<html>
-
<head>
-
<meta charset="UTF-8">
-
<title>VUE绑定模式</title>
-
<script src="js/vue.js"></script>
-
</head>
-
<body>
-
<div id="app">
-
<p>input标签元素</p>
-
<input v-model="message" placeholder="编辑我" />
-
<p>消息是:{{message}}</p>
-
<hr />
-
<p>textarea元素的案例</p>
-
<p style="background: #444444;">{{message2}}</p>
-
<textarea v-model="message2" placeholder="多行文本框输入..."></textarea>
-
</div>
-
<!--js代码-->
-
<script>
-
new Vue({
-
el:'#app',
-
data:{
-
message:'VUE案例模式',
-
message2:'前端视频,www.csdn.net'
-
}
-
})
-
</script>
-
</body>
-
</html>
-
-
-
<!DOCTYPE html>
-
<html>
-
<head>
-
<meta charset="UTF-8">
-
<title>v-model案例2</title>
-
<script src="js/vue.js"></script>
-
</head>
-
<body>
-
<!--布局设计-->
-
<div id="app">
-
<p>复选框:</p>
-
<input type="checkbox" id="checkbox" v-model="checked">
-
<label for="checkbox">{{ checked }}</label>
-
<p>多个复选框</p>
-
<input type="checkbox" id="rubbo" value="rubbo" v-model="checkedNames" />
-
<label for="rubbo">rubbo</label>
-
<input type="checkbox" id="java" value="java" v-model="checkedNames" />
-
<label for="java">java</label>
-
<input type="checkbox" id="python" value="python" v-model="checkedNames" />
-
<label for="python">python</label>
-
<br />
-
<span>选择值为:{{checkedNames}}</span>
-
</div>
-
<script>
-
new Vue({
-
el:'#app',
-
data:{
-
checked:false,
-
checkedNames:[]
-
}
-
})
-
</script>
-
</body>
-
</html>
-
<!DOCTYPE html>
-
<html>
-
<head>
-
<meta charset="UTF-8">
-
<title>VUE单选按钮案例3</title>
-
<script src="js/vue.min.js"></script>
-
</head>
-
<body>
-
<!--布局-->
-
<div id="app">
-
<input type="radio" id="agree" value="agree" v-model="picked" />
-
<label for="agree">agree</label>
-
<input type="radio" id="disagree" value="disagree" v-model="picked" />
-
<label for="disagree">disagree</label>
-
<hr style="width: 400px;margin-left: 0px;"/>
-
<span>{{picked}}</span>
-
</div>
-
-
<!--js代码-->
-
<script>
-
new Vue({
-
el:'#app',
-
data:{picked:'agree'}
-
})
-
</script>
-
</body>
-
</html>
文章来源: aaaedu.blog.csdn.net,作者:tea_year,版权归原作者所有,如需转载,请联系作者。
原文链接:aaaedu.blog.csdn.net/article/details/86570061
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)