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

  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();    },

体验地址 鸿枫网盘

相关推荐
星语卿23 分钟前
Vuetify:构建优雅Vue应用的Material Design组件库
前端·javascript·vue.js
wangbing112533 分钟前
界面规范11-对话框
javascript·vue.js·elementui
不一样的少年_1 小时前
Vue3 后台分页写腻了?我用 1 个 Hook 删掉 90% 重复代码(附源码)
前端·vue.js·设计模式
一枚前端小能手1 小时前
🔥 滚动监听写到手抽筋?IntersectionObserver让你躺平实现懒加载
前端·javascript
我是日安1 小时前
从零到一打造 Vue3 响应式系统 Day 5 - 核心概念:单向链表、双向链表
前端·vue.js
遂心_1 小时前
React中的onChange事件:从原理到实践的全方位解析
前端·javascript·react.js
GHOME1 小时前
原型链的原貌
前端·javascript·面试
槿泽1 小时前
Vue集成Electron目前最新版本
前端·vue.js·electron
luckyCover1 小时前
带你一起攻克js之原型到原型链~
前端·javascript
麦当_1 小时前
SwipeMultiContainer 滑动切换容器算法指南
前端·javascript·算法