問題就是當我上傳圖片得時候有得時候可以上傳成功有得時候失敗失敗得原因就是沒有獲取到file對象這是為什么呢,我用了圖片壓縮插件lrz請大神幫我看看是什么原因出現得問題這是我得代碼上傳憑證onUpload(item){varinput=document.getElementById("input");varfile=event.target.files[0];let_this=this;lrz(file,{width:400}).then(function(rst){rst.formData.append("sessionId",_this.data.sessionId);rst.formData.append("fileUpload1",file);rst.formData.append("referenceNo",item.paySeqId);rst.formData.append("clientType","wx");rst.formData.append("purpose","paymentBill");console.log(rst.fileLen);_this.$toast.loading({mask:true,message:"上傳中..."});_this.$post(_this.$api.upload,rst.formData).then(res=>{console.log(res);if(res.data.flag==0){_this.$toast.clear_this.$toast.success("上傳成功");varinput=document.getElementById("input");input.value="";}else{_this.$toast.fail(res.data.message);}});console.log(rst.formData);}).catch(function(error){console.log(error);}).always(function(){//不管成功或失敗,都會執行});},
vue h5頁面 上傳圖片問題
慕標琳琳
2019-05-06 21:42:50