YApi 接口多级目录改造

render(){
    ...
    ...

const loop = data => data.map((item) => {
  // if (item.list && item.list.length >= 0) {
  if (item.itemType === 'cat') { // 一级目录
    return (
       this.enterItem(item._id)}
            onMouseLeave={this.leaveItem}
          >
             {
                e.stopPropagation();
                this.changeExpands();
              }}
              to={'/project/' + matchParams.id + '/interface/api/cat_' + item._id}
            >
              
              {item.name || item.title}
            
            
{ e.stopPropagation(); this.showDelCatConfirm(item._id); }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} /> { e.stopPropagation(); this.changeModal('change_cat_modal_visible', true); this.setState({ curCatdata: item }); }} /> { e.stopPropagation(); this.changeModal('visible', true); this.setState({ curCatid: item._id, parentid: null }); }} /> { e.stopPropagation(); this.changeModal('add_folder_modal_visible', true); this.setState({ curCatid: item._id, parentid: null }); }} /> { e.stopPropagation(); this.changeModal('add_file_modal_visible', true); this.setState({ curCatid: item._id, parentid: null }); }} />
} key={'cat_' + item._id} className={`interface-item-nav1`} isLeaf={true} autoExpandParent > {loop(item.list)} ) } else if(item.record_type === 2) { //文件夹类型 return ( this.enterItem(item._id)} onMouseLeave={this.leaveItem} >
e.stopPropagation()}> {item.title || item.name}
{ e.stopPropagation(); this.showConfirm(item); }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} /> { e.stopPropagation(); this.changeModal('change_dir_modal_visible', true); this.setState({ curDirData: item }); }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} /> { e.stopPropagation(); this.changeModal('add_folder_modal_visible', true); this.setState({ curCatid: item.catid, curParentId: item._id }); }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} /> { e.stopPropagation(); this.changeModal('visible', true); this.setState({ curCatid: item.catid, curParentId: item._id }); }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} /> { e.stopPropagation(); this.changeModal('add_file_modal_visible', true); this.setState({ curCatid: item.catid, curParentId: item._id }); }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} />
} key={'cat_' + item._id} isLeaf={true} autoExpandParent > {item.list && loop(item.list)} ) } else { return ( //文档 api类型 this.enterItem(item._id)} onMouseLeave={this.leaveItem} > { e.stopPropagation(); this.changeExpands(); }} to={'/project/' + matchParams.id + '/interface/api/' + item._id} > {item.record_type == 0 ? () : ('')} {item.record_type == 1 ? () : ('')} {item.title || item.name}
{ e.stopPropagation(); this.showConfirm(item); }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} /> {item.record_type === 0 ? ( { e.stopPropagation(); this.copyInterface(item._id); }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} /> ) : ('') }
} key={'' + item._id} isLeaf={true} autoExpandParent />) } }) return( 。。。 。。。 { e.stopPropagation(); this.changeExpands(); }} to={'/project/' + matchParams.id + '/interface/api'} > 全部接口 } key="root" /> {loop(menuList)} ) }

 

你可能感兴趣的:(YApi 接口多级目录改造)