全选 vue
来源:互联网 发布:有组织犯罪知乎 编辑:程序博客网 时间:2024/05/18 00:54
JSFillder https://jsfiddle.net/
原文地址https://jsfiddle.net/addbwdau/
<div class="app"> <table class="table"> <thead> <tr> <th>#</th> <th>Name</th> <th>Age</th> </tr> </thead> <tbody> <tr> <td><input type="checkbox" v-model="allChecked"/>全选{{allChecked}}</td> </tr> <tr v-for="item in list"> <td><input type="checkbox" v-model="item.checked" /></td> <td>{{item.name}}</td> <td>{{item.age}}</td> </tr> </tbody> </table></div>
var _list = [{name:"小明",age:23, checked: false},{name:"小红",age:20, checked: true},{name:"ddd",age:30, checked: true}]; new Vue({ el: '.app', computed: { allChecked: { get: function(){ return this.checkedCount == this.list.length; }, set: function(value){ this.list.forEach(function(item){ item.checked = value }) return value; } }, checkedCount: { get: function(){ var i = 0; this.list.forEach(function(item){ if(item.checked == true) i++; }) return i; } } }, data:{ list: _list } });
0 0
- 全选 vue
- Vue CheckBox 全选
- vue.js实现checkbox全选
- 用Vue实现一个全选指令
- Vue自定义指令实现checkbox全选功能
- vue的全选与反选
- 用Vue实现一个全选指令
- vue 多层选择按钮的全选
- vue.js实现全选和全不选
- Vue.js实现checkbox的全选和反选
- Vue 2.0 全选,反选,全不选(二)
- Vue.js实现checkbox的全选和反选
- Vue.js实现checkbox的全选和反选
- 用Vue.js实现全选与全不选删除功能
- vue todomvc案例中全选框出错,需要点三次才能完成全选取消全选两种操作
- vue+element-ui,树形表格,可以做权限管理模块,可折叠,全选,部分全选
- 全选
- 全选
- 检测内存泄漏malloc模块
- 遍历Map的六种方法
- 下载单张图片到本地相册
- RTMPdump(libRTMP) 源代码分析 9: 接收消息(Message)(接收视音频数据)
- 动画的显示与隐藏
- 全选 vue
- Oracle意外删除数据文件恢复方法
- rsync常见问题
- HDU 1564 考虑奇偶性的变化
- Scala eclipse 错误 -找不到或无法加载主类
- GitHub NPoco 调用存储过程
- RTMPdump(libRTMP) 源代码分析 10: 处理各种消息(Message)
- android:windowSoftInputMode属性使用
- hdu Find a way