给img标签的src属性使用file文件对象

https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL

 

 

 

读取到的file文件对象,

想给img标签使用,直接挂到src上不能用 

可以用这个api操作下

 

img.src = window.URL.createObjectURL(file);

 

posted @ 2020-07-03 17:17  hh9515  阅读(4422)  评论(0编辑  收藏  举报