【uniapp】自定义多级折叠面板 ,搜索用JS递归遍历树结构

 页面展示

组件代码

components/collapse/sidebar-item.vue
<template>
  <view class="Sidebar">
    <scroll-view style="white-space: nowrap;width: 100%;height: 100%;" scroll-y="true">
      <view v-for="(item,index) in arr" :key='index'>
        <view class="allbox" @click="lock(item,index)">
          <view class="title_box">
            <slot name="title">
<!--              <image v-if="thumb" :src="thumb" class="img"></image>-->
<!--              <image v-else :src="item.img" class="img"></image>-->
              <view>
                <view :class="{'box':true,'title':item.show && active === item.deptId}">
                  {
  {item.deptName?item.deptName:'标题'}}
                </view>
                <view class="Subtitle" v-if="Subtitle">
                  {
  {item.Subtitle?item.Subtitle:'副标题'}}
                </view>
              </view>
            </slot>
          </view>
          <view v-if="item.child && item.child.length > 0" class="right">
            <u-icon v-if
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值