mirror of
https://gitee.com/coder-xiaomo/flashsale
synced 2025-09-12 23:11:38 +08:00
添加Metronic(作为LFS)
This commit is contained in:
36
frontend/static/assets/admin/pages/scripts/form-dropzone.js
Normal file
36
frontend/static/assets/admin/pages/scripts/form-dropzone.js
Normal file
@@ -0,0 +1,36 @@
|
||||
var FormDropzone = function () {
|
||||
|
||||
|
||||
return {
|
||||
//main function to initiate the module
|
||||
init: function () {
|
||||
|
||||
Dropzone.options.myDropzone = {
|
||||
init: function() {
|
||||
this.on("addedfile", function(file) {
|
||||
// Create the remove button
|
||||
var removeButton = Dropzone.createElement("<button class='btn btn-sm btn-block'>Remove file</button>");
|
||||
|
||||
// Capture the Dropzone instance as closure.
|
||||
var _this = this;
|
||||
|
||||
// Listen to the click event
|
||||
removeButton.addEventListener("click", function(e) {
|
||||
// Make sure the button click doesn't submit the form:
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// Remove the file preview.
|
||||
_this.removeFile(file);
|
||||
// If you want to the delete the file on the server as well,
|
||||
// you can do the AJAX request here.
|
||||
});
|
||||
|
||||
// Add the button to the file preview element.
|
||||
file.previewElement.appendChild(removeButton);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}();
|
Reference in New Issue
Block a user