dropzone js autoProcessQueue在Vue组件中不起作用

时间:2018-11-28 17:33:37

标签: vue.js dropzone

您好,我在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>
  

打印屏幕

enter image description here

  

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);
            });
    }
})

},

我仍然不确定我在这里缺少什么,但是因为这是我第一次同时使用这两种方法,所以我对使用说明一无所知。感谢您的答复!

1 个答案:

答案 0 :(得分:0)

我找到了一个我不建议使用的解决方法,我认为这不是最好的解决方案...如果有人知道更好的解决方案,请发表评论...

我必须编辑dropzone.js源代码并设置autoProcessQueue = false,

enter image description here

我认为dropzone对象的本地设置无法覆盖全局autoProcessQueue配置...

相关问题