zoukankan      html  css  js  c++  java
  • 做类似百度云盘中返回的功能

    双击文件名称进入下一级的内容,需要点击返回按钮返回。多级情况下做返回。返回的时候根据parentId去做判断。

    双击文件夹的时候,将文件的parentId存入到一个空数组中,因为文件的第一级的id是0,所以数组中初始化的时候是要有一个0的。然后就是每次双击都会将parentId存入数组中,返回的时候就根据数组中的id去判断请求数据。我这里数组的名字是 oldPrrentIdList

    nextFolder(fileId, fileType) {
                this.num++;
                this.fileType = fileType;
                this.fileId = fileId;
                if (fileType == 0) {
                    this.temp = [];
                    this.oldParentId = this.queryForm.parentId;
                    if (fileId == 0) {
                        this.queryForm.fileType = 0;
                        this.queryForm.parentId = undefined;
                    } else {
                        this.queryForm.fileType = undefined;
                        this.queryForm.parentId = fileId;
                        this.oldPrrentIdList.push(fileId);
                    }
                    console.log(this.oldPrrentIdList, 'this.oldPrrentIdList');
                    this.getList(this.temp);
                }
    },
    backParent() {
        if (!this.$route.params.val) {
            this.temp = [];
            this.countNum++;
            if (this.oldPrrentIdList.length > 1 && this.countNum == 1) {
                this.oldPrrentIdList.splice(this.oldPrrentIdList.length - 1, 1);
            }
            if (this.oldPrrentIdList.length > 1) {
                this.queryForm.parentId = this.oldPrrentIdList[this.oldPrrentIdList.length - 1];
                this.oldPrrentIdList.splice(this.oldPrrentIdList.length - 1, 1);
                console.log(this.oldPrrentIdList, '1');
            } else if (this.oldPrrentIdList.length == 1) {
                this.queryForm.parentId = 0;
            }
            if (this.queryForm.parentId == 0) {
                this.temp = [{
                    imgSrc: file,
                    title: '收藏夹',
                    checkModel: false,
                    fileType: 0,
                    showModel: true,
                    id: 0,
                    fileLabelArray: null
                }];
            }
            this.queryForm.fileType = undefined;
            this.getList(this.temp);
        } else {
            this.getFile();
        }
    },
  • 相关阅读:
    Spring boot 集成三种拦截方式
    Spring boot 异常处理配置
    Linux 启动、停止、重启tomcat工具(Shell脚本)
    Java 序列化对象工具类
    Spring boot 集成 Swagger
    Spring boot 项目导出可执行jar
    包扫描自定义注解类并实例化
    Zuul 网关搭建
    Hystrix + Hystrix Dashboard搭建(Spring Cloud 2.X)
    Feign + Hystrix 服务熔断和服务降级
  • 原文地址:https://www.cnblogs.com/florazeng/p/13579774.html
Copyright © 2011-2022 走看看