当前位置:网站首页>微信小程序中的列点击隐藏,再点击显示
微信小程序中的列点击隐藏,再点击显示
2022-07-25 09:17:00 【zk_Kang】
先上图,

小程序中的,js中的前台数据进行加载
DATA_TO_ListOneResetUserPwd: function (that, data) {
var rows = data;//data为查询的数据,自己根据自己情况自己生成就行
for (var i = 0; i < rows.length; i++) {
var tempObject = {};
tempObject.menuid = rows[i].MENU_ID;
tempObject.index = i;
tempObject.Arrays = [];
if (rows[i].MENU_ID.toString().length == "2") {
tempObject.image ="../../../../../resources/img/menu/xia.png"
// tempObject.MENU_NAME_tow = rows[i].MENU_NAME;
tempObject.CHCKED = false;//这个是控制,初始化显示
tempObject.Arrays.push(rows[i].MENU_NAME);
}
tempObject.Arrays2 = [];
if (rows[i].MENU_ID.toString().length == "4") {
tempObject.CHCKED = true;//初始化隐藏
if (rows[i].QXBJ!=null){
var qx = rows[i].QXBJ.split('_');
tempObject.EDIT_BJ = parseInt(qx[0]);
tempObject.SH_BJ = parseInt(qx[1]);
tempObject.SELECT_BJ = parseInt(qx[2]);
tempObject.PRINT_BJ = parseInt(qx[3]);
tempObject.QXALL = parseInt(qx[4]);
}else{
tempObject.EDIT_BJ = 0;
tempObject.SH_BJ = 0;
tempObject.SELECT_BJ = 0;
tempObject.PRINT_BJ = 0;
tempObject.QXALL = 0;
}
tempObject.Arrays2.push(rows[i].MENU_NAME);
}
that.data.listOne.push(tempObject);
}
that.setData({
listOne: that.data.listOne,
});
},js中进行点击方法
clickLine:function(e){//点击事件,进行显隐控制
var that= this;
var index = e.currentTarget.dataset.index;
var menuid = e.currentTarget.dataset.menuid;
var Alllist = that.data.listOne;
for (var i = 0; i < Alllist.length; i++) {
if (Alllist[i].menuid.toString().length==4 && Alllist[i].menuid.toString().substring(0, 2) == menuid) {
if (Alllist[i].CHCKED == true) {
Alllist[i].CHCKED = false;
} else {
Alllist[i].CHCKED = true;
}
}
}
that.setData({
listOne: Alllist,
// ALLList: that.data.ALLList,
// _Total: data.total
});
wxhl中:
<view class='hz-main_tow' wx:for="{
{listOne}}" wx:for-item="row" wx:key="Arrays">
<view data-menuid="{
{row.menuid}}" class='hz-list' data-index="{
{row.index}}" hidden="{
{row.CHCKED}}" bindtap='clickLine' wx:for="{
{row.Arrays}}" wx:for-item="item" wx:key="title" >
<text class='hz-content'>{
{item}}</text>
<image src="{
{row.image}}" style='max-height:15px;max-width:15px;padding-left: 10px;'></image>
</view>
<view data-menuid="{
{row.menuid}}" data-index="{
{row.index}}" hidden="{
{row.CHCKED}}" class='hz-list' wx:for="{
{row.Arrays2}}" wx:for-item="item" wx:key="title" >
<checkbox-group data-index="{
{row.index}}" name="CHCKED_{
{row.menuid}}" data-menuid="{
{row.menuid}}" bindchange="changeCHCMenuid" >
<label >
<checkbox color="green" value="{
{row.menuid}}" checked="{
{row.QXALL}}"><text class='selectCon-list-tit_tow'>{
{item}}</text></checkbox>
</label>
</checkbox-group>
<checkbox-group bindchange="changeCHCMenuid_Two" data-index="{
{row.index}}" data-menuid="{
{row.menuid}}">
<label class='selectCon-tit-label'>
<checkbox color="green" value="1" name="cboQxEdit" checked="{
{row.EDIT_BJ}}">编辑</checkbox>
</label>
<label wx:key="id" class='selectCon-tit-label'>
<checkbox color="green" value="2" name="cboQxSH" checked="{
{row.SH_BJ}}">审核</checkbox>
</label>
<label wx:key="id" class='selectCon-tit-label'>
<checkbox color="green" value="3" name="cboQxSearch" checked="{
{row.SELECT_BJ}}">查询</checkbox>
</label>
<label wx:key="id" class='selectCon-tit-label'>
<checkbox color="green" value="4" name="cboQxPrint" checked="{
{row.PRINT_BJ}}">打印</checkbox>
</label>
</checkbox-group>
</view>
</view>
边栏推荐
- Probe into Druid query timeout configuration → who is the querytimeout of datasource and jdbctemplate effective?
- activemq--消息重试机制
- uni-app - Refused to display ‘xxx‘ in a frame because an ancestor violates the following Content Sec
- mysql中的数据结果排名
- JS pop-up City filtering component matches mobile terminal
- ActiveMQ -- message retry mechanism
- BigDecimal 对数据进行四舍五入
- registration status: 204
- 『每日一问』LockSupport怎么实现线程等待、唤醒
- Detailed explanation of pipeline pipeline mechanism in redis
猜你喜欢
![[stl]list Simulation Implementation](/img/92/2a78382700c1ebf299c6505d962c9c.png)
[stl]list Simulation Implementation

『每日一问』ReentrantLock加锁解锁

Feiling ok1028a core board adapts to rtl8192cu WiFi module

yarn : 无法加载文件 yarn.ps1,因为在此系统上禁止运行脚本。

Nacos搭建配置中心出现client error: invalid param. endpoint is blank

将list集合的某一字段拼接单个String

This ten-year content industry infrastructure company is actually an invisible Web3 pioneer

ActiveMQ -- JDBC Journal of persistent mechanism
![[buuctf-n1book][Chapter 2 advanced web]ssrf training](/img/29/8894d04b27e0e73c4458c27bd9b935.png)
[buuctf-n1book][Chapter 2 advanced web]ssrf training
[learn rust together] a preliminary understanding of rust package management tool cargo
随机推荐
A picture to quickly understand envoyfilter in istio
C#语言和SQL Server数据库技术
ActiveMQ -- message retry mechanism
Arrange the array into the smallest number
Software examination system architecture designer concise tutorial | software life cycle
Wechat applet obtains the data of ---- onenet and controls the on-board LED of STM32
JS small game source code magic tower breakthrough Download
Shell脚本
[deep learning] overview | the latest progress of deep learning
分享一个避免递归的部门设计方法
How to write the code of wechat applet implementation tab
【线程知识点】-- 自旋锁
Ten thousand words long, one word thoroughly! Finally, someone has made business intelligence (BI) clear
activemq--消息重试机制
registration status: 204
Silicon Valley classroom lesson 15 - Tencent cloud deployment
nacos2.1.0集群搭建
有误差的字符串型时间比较方法String.compareTo
Programmers can't SQL? Ashes Engineer: all waiting to be eliminated! This is a must skill!
『每日一问』LockSupport怎么实现线程等待、唤醒