微信小程序获取复选框全选反选选中的值(实例代码)

这篇文章主要介绍了微信小程序获取复选框全选反选选中的值,本文通过实例代码给大家简单介绍,需要的朋友可以参考下

wxml文件

   全选 id名称   {{item.code}}{{item.text}}

wxss文件

 .table{ background-color: #fff; border:1px solid #dadada; width:1200rpx; margin-left:0rpx; } .tr{ background-color: #dadada; white-space: nowrap; width:100%; display: flex; text-align: center; justify-content: center; } .th{ background-color: #fff999; text-align: center; justify-content: center; width: 100%; border-bottom: 1px solid #dadada; border-right: 1px solid #dadada; } .td{ background-color: #fff; text-align: center; justify-content: center; width: 100%; border-bottom: 1px solid #dadada; border-right: 1px solid #dadada; }

js文件

 Page({ data: { select_all: false, listData: [ { code: "1", text: "测试1" }, { code: "2", text: "测试2"}, { code: "3", text: "测试3"} ], batchIds: '',  //选中的ids }, //全选与反全选 selectall: function (e) { console.log(e) var that = this; var arr = [];  //存放选中id的数组 for (let i = 0; i 

效果图:

总结

以上所述是小编给大家介绍的微信小程序获取复选框全选反选选中的值,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对html中文网网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

以上就是微信小程序获取复选框全选反选选中的值(实例代码)的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » JavaScript 教程