如何将DOM发送到服务器(Vuejs)中的图像?

时间:2020-05-10 10:37:26

标签: vue.js

请任何人告诉我如何将Base64图像发送到服务器,我正在使用Dom到图像库。

    let simpleArray = [{"weight": "2kg"},{"weight": "5kg"}];
    
    function kilosNumber(arrayToSort){
     
    
    
      //Let's map the array and change the item weight
      let sortedArray = simpleArray.map(function(object){
        return { ...object, weight: parseFloat(object.weight)};
      });
      return sortedArray;
    };
    
    console.log(kilosNumber(simpleArray));
    console.log(simpleArray);

1 个答案:

答案 0 :(得分:0)

   imgProfile(event) {
       this.image = event.target;
        if (this.image.files && this.image.files[0]) {
            var reader = new FileReader();
            reader.onload = (e) => {
                this.imageData = e.target.result;
            }
            reader.readAsDataURL(this.image.files[0]);
            this.SvImage = this.image.files[0];
        }

    },