var enclo = row.sceneImg.split(",");
            // 将文件转为blob对象,再转为file对象
            enclo.forEach((item) => {
                if (item) {
                    var name =
                        "http://61.153.185.211:8084/LightningDetection/ProjectOriginalRecord/" +
                        item;
                    this.changeBlob(name).then((res) => {
                        var na = name.split("/");
                        const files = new File([res], na[na.length - 1], {
                            type: res.type,
                        });
                        // var Blob = window.URL.createObjectURL(res);
                        this.fileListPng.push(files);
                    });
                }
            });
 // 地址转文件
        changeBlob(url) {
            return new Promise((resolve) => {
                const xhr = new XMLHttpRequest();
                xhr.open("GET", url, true);
                xhr.responseType = "blob";
                xhr.onload = () => {
                    if (xhr.status === 200) {
                        resolve(xhr.response);
                    }
                };
                xhr.send();
            });
        },

 

posted on 2022-03-09 16:42  shihongbo  阅读(3798)  评论(0)    收藏  举报