博客
关于我
原生js之图片预览的封装
阅读量:201 次
发布时间:2019-02-28

本文共 270 字,大约阅读时间需要 1 分钟。

图片预览

_this:input[file]对象

_thisNext:下一个要操作的dom对象
cb:回调函数

function changeImg(_this,_thisNext,cb){	var reader = new FileReader();    reader.readAsDataURL(_this.files[0]);	reader.onload = function(e){		_this.nextSibling.src = e.target.result;		if(cb){			cb(_thisNext);		}	}}

转载地址:http://lohi.baihongyu.com/

你可能感兴趣的文章
new和delete用法小结
查看>>
new对象时,JVM内部究竟藏了什么小秘密?
查看>>
new操作符的实现原理
查看>>
Next.js React Server Components 教程
查看>>
NextGen Mirth Connect XStream反序列化远程代码执行漏洞(CVE-2023-43208)
查看>>
next项目部署到服务器pm2进程守护
查看>>
nexus 介绍
查看>>