标签:javascript jquery dropzone-js
在Dropzonejs我创建删除按钮,然后将其附加到缩略图,我如何通过使用addRemoveLinks直接链接我从服务器geeting的网址删除按钮:true,
//Write function if you need to add some event after files added
myDropzone.on("addedfile", function(file) {
console.log('Files Added using ---------->'+$attrs.apiCall);
var _this=this;
/* Maybe display some more file information on your page */
var removeButton = Dropzone.createElement("<button data-dz-remove>-Remove file</button>");
removeButton.addEventListener("click", function(e) {
e.preventDefault();
e.stopPropagation();
_this.removeFile(file);
});
file.previewElement.appendChild(removeButton);
});
解决方法:
这适用于Dropzone 5.0.0
<script>
Dropzone.options.dropzoneForm = {
addRemoveLinks: true,
dictDefaultMessage: "<strong>Drop files here or click to upload. </strong>",
init: function() {
this.on("complete", function(file) {
$(".dz-remove").html("<div><span class='fa fa-trash text-danger' style='font-size: 1.5em'></span></div>");
});
}
};
</script>
标签:javascript,jquery,dropzone-js 来源: https://codeday.me/bug/20191006/1858271.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。