-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
多图片上传&预览,如何删除指定图片 #19
Comments
已添加删除按钮,默认隐藏,可通过样式配置为显示,见demo |
效率真高,谢谢。 |
这是我实现的单张图片的上传预览,实现当前图片替换上张图片。感觉太繁琐,自己有时候都看不懂。能帮忙整合下吗? |
已添加单图片上传demo,主要代码如下: new Uploader({
//选择文件时是否允许多选
multiple: false,
on: {
//添加之前触发
add: function (task) {
this.ops.view.innerHTML = '';
this.list = [];
this.map = {};
this.index = 0;
this.workerIdle = 1;
}
}
}); |
添加一张图片,console.log(this.list); 输出数组中会产生两个对象并且内容相同。添加2张图片会输入4个对象 |
点击右上角的删除,this.map和this.list依然保存着之前的数据。 |
self.list.splice(taskId, 1); |
在启用了压缩的情况下,同一个任务会有2条数据,但只会上传一次,忽略即可。 |
多图片上传&预览,如何删除指定图片。类似每张图片右上角有个叉,点击就删除。
The text was updated successfully, but these errors were encountered: