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

  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>    
复制代码
   定义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();    },

体验地址 鸿枫网盘

相关推荐
mCell19 小时前
GSAP ScrollTrigger 详解
前端·javascript·动效
gnip19 小时前
Node.js 子进程:child_process
前端·javascript
codingandsleeping1 天前
使用orval自动拉取swagger文档并生成ts接口
前端·javascript
白水清风1 天前
微前端学习记录(qiankun、wujie、micro-app)
前端·javascript·前端工程化
用户22152044278001 天前
new、原型和原型链浅析
前端·javascript
阿星做前端1 天前
coze源码解读: space develop 页面
前端·javascript
叫我小窝吧1 天前
Promise 的使用
前端·javascript
用户51681661458411 天前
Vue Router 路由懒加载引发的生产页面白屏问题
vue.js·vue-router
前端康师傅1 天前
JavaScript 作用域
前端·javascript
前端缘梦1 天前
Vue Keep-Alive 组件详解:优化性能与保留组件状态的终极指南
前端·vue.js·面试