• app 检测总结


    1.upload:

        文件校验:

    const apkArray = file.name.split(".");
                    const isApk = apkArray[apkArray.length-1] === 'apk';
                    const isLt100M = file.size / 1024 / 1024 < 100;
                    if(!isApk){
                        this.$message.error('上传文件只能是 apk 格式!');
                        return false
                    }
                    if (!isLt100M) {
                        this.$message.error('上传icon大小不能超过 30MB!');
                        return false
                    }

        文件md5

    uploadChange(file,fileList){
                    let _this = this;
                    let fileRaw = file.raw;
                    this.sFile = file.raw;
                    let blobSlice = File.prototype.slice ||     File.prototype.mozSlice || File.prototype.webkitSlice,
                        spark = new SparkMD5.ArrayBuffer(),
                        fileReader = new FileReader(); 
                    fileReader.onload = function(e){
                        spark.append(e.target.result);   
                        _this.sendData.file_md5 = spark.end().toUpperCase() ;
                        console.log(_this.sendData.file_md5)      // Append array buffer            
                    }
                    fileReader.readAsArrayBuffer(blobSlice.call(fileRaw, 0, fileRaw.size));   
                }

      文件分片上传

    每次上传通过slice(start,end) 分片上传

        表格刷新滚动到顶部

    this.$refs.table.wrapperBody.scrollTop = 0

        表格搜索

    1.监听input框  将对应的值赋给搜索的值   2. this.$emit('搜索)

        路由返回

    采用在路由跳转的时候传递history参数   history用来存储当前路由 每次跳转就push当前路由  返回就pop当前路由

        父子页面生命周期顺序

    1.加载渲染过程:父 beforeCreated   父 created   父beforeMounted  子beforeCreated  子created   子 beforeMounted   子mounted   父mounted

    2.更新过程: 父beforeUpdate->子beforeUpdate->子updated->父updated

    3.销毁过程:父beforeDestroy->子beforeDestroy->子destroyed->父destroyed

       模拟一键复制

      

    function handleCopy(val){
        var oInput = document.createElement('input');
        oInput.value = val;
        document.body.appendChild(oInput);
        oInput.select();
        document.execCommand("Copy"); 
        oInput.className = 'oInput';
        oInput.style.display = 'none';
        Message({
            'type':'success',
            "message":'复制成功'
        })
    }

             时间格式化

      

    function dateFormat(fmt, date) {
        let ret;
        let opt = {
            "Y+": date.getFullYear().toString(),        //
            "m+": (date.getMonth() + 1).toString(),     //
            "d+": date.getDate().toString(),            //
            "H+": date.getHours().toString(),           //
            "M+": date.getMinutes().toString(),         //
            "S+": date.getSeconds().toString()          //
            // 有其他格式化字符需求可以继续添加,必须转化成字符串
        };
        for (let k in opt) {
            ret = new RegExp("(" + k + ")").exec(fmt);
            if (ret) {
                fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
            };
        };
        return fmt;
    }

      

        

  • 相关阅读:
    position : sticky
    学习笔记之段落里面最后出现省略号
    two or more web modules defined in the configuration have the same context root
    Android笔记:ActivitySpinner
    设计一个通讯录的XML文件
    使用JDBC连接SQL Server数据库
    SNMP使用UDP传送报文。为什么不使用TCP?
    计算Java程序运行时间
    android在xml的textStyle中,设置一个字体是粗体或斜体或带有下划线
    schema.xml文件里datatype的定义格式
  • 原文地址:https://www.cnblogs.com/tutao1995/p/11608174.html
Copyright © 2020-2023  润新知