您好,我在vue组件中使用dropzone Js,我试图提交仅在单击提交按钮之后提交dropzone的表单...
HTML
<div class="form-group">
<label for="dropzone-js" class="col-md-12 control-label">Choose a profile picture:</label>
<!-- even though there is not path in the action there is still a post request -->
<form action="#"
class="dropzone"
id="dropzone-js"></form>
</div>
打印屏幕
Vue组件脚本
ready(){
// I´ve tried to implement the autoProcessQueue to false in many ways, but
// withouth the desired result
Dropzone.forElement(".dropzone").options.autoProcessQueue = false;
Dropzone.options.autoProcessQueue = false;
new Dropzone('#dropzone-js', {
paramName: "profileImg", // The name that will be used to transfer the file
maxFilesize: 2, // MB
maxFiles: 1,
autoProcessQueue:false,
autoProcessQueue: false,
uploadMultiple: false,
accept: function(file, done) {
console.log('event',event)
console.log('accepted dropzone file', file)
this.form.photo = file
// done();
},
init: function() {
this.on("addedfile", function(file, event) {
// this.form.photo = file
// alert("Added file.");
console.log('event',event)
});
},
init: function() {
this.on("maxfilesexceeded", function (file) {
alert('Only 1 file allowed')
this.removeFile(file);
});
}
})
},
我仍然不确定我在这里缺少什么,但是因为这是我第一次同时使用这两种方法,所以我对使用说明一无所知。感谢您的答复!