• 鸿枫网盘,文件夹面包屑跳转实现功能


    1. 新增功能,磁盘格式化,层级面包屑跳转,视频预览优化

    2. 主要记录一下面包屑的实现思路

      2.1 面包屑渲染

          <el-breadcrumb separator-class="el-icon-arrow-right">      <el-breadcrumb-item>        <el-link :underline="false" @click="skipCrumbs(0)">根目录</el-link>      </el-breadcrumb-item>        <el-breadcrumb-item v-for="(item,index) in crumbsList":key="index">          <el-link :underline="false" @click="skipCrumbs(item.id)">{{item.name}}</el-link>        </el-breadcrumb-item>    </el-breadcrumb>    
    3. 定义vue dataallCrumbsList: [],crumbsList: [],

      js 代码​

    4.     checkboxOndblclick(disk) {      console.log(disk);      if (disk.isDir===1) {        this.queryParams.parentId = disk.id;        const skip = {          id: disk.id,          parentId: disk.parentId,          name: disk.name        }        this.allCrumbsList.push(skip);        this.allCrumbsList = this.uniqueObjects(this.allCrumbsList);        this.crumbsList=[];        this.generateCrumbs(disk.id);        this.skipList.push(disk.id);        this.skipList = [...new Set(this.skipList)];        this.uploadFileUrl = process.env.VUE_APP_BASE_API + "/disk/file/upload/"+disk.id        this.getList();      }    },    handleSkip(skip) {      if(skip===0) {        let index = this.skipList.indexOf(this.queryParams.parentId);        this.skip(index-1)      }else {        let index = this.skipList.indexOf(this.queryParams.parentId);        this.skip(index+1)      }    },    skip(nextIndex) {      this.crumbsList=[];      if (nextIndex<0) {          this.queryParams.parentId=0;          this.allCrumbsList=[];          this.getList();      }else if (nextIndex>=this.skipList.length) {        this.queryParams.parentId =0;        this.allCrumbsList=[];        this.getList();      } else {        this.queryParams.parentId = this.skipList[nextIndex];        this.generateCrumbs(this.queryParams.parentId);        this.getList();      }    }, uniqueObjects(arr) {      const unique = [];      const seen = new Set();      arr.forEach(item => {        const stringifiedItem = JSON.stringify(item);        if (!seen.has(stringifiedItem)) {          unique.push(item);          seen.add(stringifiedItem);        }      });      return unique;    },    generateCrumbs(id) {      if (id===0) {        this.crumbsList = this.crumbsList.reverse();        return;      }      const crumbs = this.getCrumbsListById(id);      if (crumbs!=null&&crumbs!=undefined) {        this.crumbsList.push(crumbs);        this.generateCrumbs(crumbs.parentId);      }    },    getCrumbsListById(id) {      return this.allCrumbsList.find(item => {        return item.id === id;      });    },    skipCrumbs(id) {      this.queryParams.parentId = id;      this.crumbsList = [];      this.generateCrumbs(this.queryParams.parentId);      this.getList();    },

    体验地址  鸿枫网盘

  • 相关阅读:
    【实例项目:基于多设计模式下的日志系统(同步&异步)】
    异形双柱体阵列纳米粒:针状/花状纳米粒子/纳米金星/金笼/金壳/三角形纳米金
    docker的使用
    vue开启splitChunks分包处理
    C++ 类型转换(static_cast、dynamic_cast、reinterpret_cast、const_cast)
    cisco设备信息泄漏漏洞案例【二】
    【小程序】实现一个定制的音乐播放器
    好看的错误页面分享
    协程和Flow
    新手小白看过来——带你快速入门跨境电商
  • 原文地址:https://blog.csdn.net/Honmaple/article/details/139881572