宝哥软件园

微信小程序实现多选框全选与取消全选功能示例

编辑:宝哥软件园 来源:互联网 时间:2021-08-24

本文实例讲述了微信小程序实现多选框全选与取消全选功能。分享给大家供大家参考,具体如下:

射流研究…部分:

page({ data : { select _ all : false,listData: [{code: '111 ',text: 'text1 ',typ: 'type1 ',},{code: '021 ',text: 'text2 ',typ: 'type2 ',},{code: '111 ',text: 'text1 ',typ 333333330全选与反全选变量=这个;用于(设I=0;那个。数据。列出数据。长度;i ) {that.data.listData[i].选中=(!那个。数据。select _ all)}那个。setdata({ listdata :数据。listdata,select_all:(!that.data.select_all)})}})wxml部分:

view class=' scroll ' scroll-view scroll-x=' true '复选框-group class=' table ' view class=' tr ' view class=' th '复选框值=' all ' bind tap=' selectall '/全选/viewview class='th '运号/viewview class='th'V号/viewview class='th '运商/viewview class='th '返单/viewview class='th '日期/view/view class=' tr ' wx : for=' { { listData } } ' wx : key=' ' view class=' TD '复选框值=' { { item。代码} } '选中=' { { item。已选中} } '//视图类=' TD '值=' { { item。code } }/view class=' TD ' value=' { { item。文本} } ' { { item。文本} }/视图类=' TD '值='部分:表格{底色: # fffborder:1px实心#达达达宽度宽度:1200rpx左边距left:0rpx}。tr {底色: #达达;空白: nowrap宽度:100%;显示: flex文本对齐:中心;正义-内容:中心;}.th {底色: # fff 999文本对齐:中心;正义-内容:中心;宽度: 100%;边框-底部: 1px实心# dadab order-right : 1px实心#哒哒哒}。td {背景-color : # fff;文本对齐:中心;正义-内容:中心;宽度: 100%;边框-底部: 1px实心# dadab order-right : 1px实心#达达达}效果图:

希望本文所述对大家微信小程序开发有所帮助。

更多资讯
游戏推荐
更多+