Upload pictures on elementui

the image component of the elementui upload photo wall used in the project is adjusted with the backend, and the url returned to me by the backend is a string. To transmit multiple images, I need to stitch together each string myself. How do I delete the stitched string when I do the delete operation? how do I know which one is selected and which one to delete?

I use a custom upload method

uploadImage (e, res) {

            let _this = this;
            let reader = new FileReader();
            reader.readAsDataURL(e.file);//base64
            reader.onload = function(){
                _this.imageName = e.file.name;
                _this.imageData = reader.result.substring(reader.result.indexOf(",") + 1);//"data:image/png;base64," 
                API.uploadImage({
                    imageName: _this.imageName,
                    imageData: _this.imageData,
                }).then(response => {
                    if (response.success) {
                        _this.form.imageList.push(response.response);
                        _this.form.roUploadImageUrls = _this.form.imageList.join(",");
                        _this.$message.success("");
                    }
                })
            };
        }
        
        elementui
        
        //
        handleRemove(file, fileList) {
        },
Mar.14,2021

when loading details, you can save the string of image passed from the backend and convert it to an array

.
this.xx.imgList=resp.xx.images

find this url, when you remove it and delete it

 handleImgRemove(file, fileList) {
   let url = file.response && file.response.data ? file.response.data : file.url;
   let index = this.xx.imgList.indexOf(url)
   this.editForm.imgList.splice(index, 1);
  }
Menu