本地將上傳圖片轉(zhuǎn)為base64碼后存到一個(gè)數(shù)組,無法連續(xù)添加相同文件,這時(shí)候如果換一張圖片添加以后,再換回上一張?zhí)砑泳蜎]問題,求解答 <input type="file" name="file" class="jokeFile" value="" id="addUppLoadFile" onChange="addUploadInvoice()" accept="image/*"> window.addUploadInvoice = ()=>{ let ffval = $("#addUppLoadFile").val(); if(!/.(jpg|jpeg|png|bmp)$/.test(ffval)){ commonModule.showAlertTips('請(qǐng)上傳jpg、jpeg、bmp、png格式的圖片') return false; } let addfile = document.getElementById('addUppLoadFile').files[0]; let rWind = new FileReader(); //本地預(yù)覽 rWind.onload = function(){ addModalVm.localImgList.push(rWind.result); console.log(addModalVm.localImgList.length) } rWind.readAsDataURL(addfile);}
本地將上傳圖片轉(zhuǎn)為base64碼后存到一個(gè)數(shù)組,無法連續(xù)添加相同文件。
DIEA
2019-03-20 18:12:57