$('input[type=file]').on('change',function(){
var reader=new FileReader();
reader.onload=function(e){
//带头
console.log(reader.result);
// 不带头
//console.log(reader.result.substring(reader.result.indexOf(",") + 1));
}
console.log(reader.readAsDataURL(this.files[0]));
})
使用JS 将图片转成base64
最新推荐文章于 2023-03-22 09:16:10 发布