报错:ERROR TypeError: Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'.这是用ionic写的\\xx.html<input type="file" (change)="selectImage(this.files)" accept="image/jpeg,image/png,image/jpg">\\xx.tsselectImage(file){ var reader = new FileReader(); reader.onload = function(file){ // console.log(evt.currentTarget) } reader.readAsDataURL(file); console.log(reader.readAsDataURL(file)); }
3 回答
米脂
TA贡献1836条经验 获得超3个赞
selectImage(event){
let reader = new FileReader();
let file = event.target.files[0];
reader.readAsDataURL(file);
reader.onload = function(){
console.log(reader.result)
}
}
繁星淼淼
TA贡献1775条经验 获得超11个赞
我想问下我怎么把blob转成base64呀。我获取的字符串为:url("blob:http://localhost:8080/cc116c31-f8f1-47b1-a87b-96d948253495")。请大神赐教
添加回答
举报
0/150
提交
取消