uploadImageGallery.options.autoProcessQueue = true is not a function
uploadImageGallery.processQueue is not a function
我怎么能解决这个问题..?
function uploadImageGallery()
{
Dropzone.autoDiscover = false;
var uploadImageGalleryVar = $(".upload__button__news").dropzone({
url: base_url+"/myRoute",
addRemoveLinks: true,
dictCancelUpload: "",
autoProcessQueue: false,
dictRemoveFile: "x"
});
}
var vmGallery = new Vue({
el: '#GalleryController',
data: { },
methods: {
AddGallery: function () {
console.log('add');
uploadImageGalleryVar.options.autoProcessQueue = true;
uploadImageGalleryVar.processQueue();
},
},
ready: function () {
uploadImageGallery();
}
});
答案 0 :(得分:0)
this
new Dropzone()
创建Dropzone实例,而不是$().dropzone?
像这样:
var vmGallery = new Vue({
el: '#GalleryController',
data: {},
methods: {
AddGallery() {
console.log('add');
// access dropzone instance through vm property
this.uploadImageGalleryVar.options.autoProcessQueue = true;
this.uploadImageGalleryVar.processQueue();
},
// move function into yor methods.
uploadImageGallery() {
Dropzone.autoDiscover = false;
// save dropzone instance as vm property
// use new Dropzone() to create it instead of jQuery shortcut
this.uploadImageGalleryVar = new Dropzone($(".upload__button__news"), {
url: base_url + "/myRoute",
addRemoveLinks: true,
dictCancelUpload: "",
autoProcessQueue: false,
dictRemoveFile: "x"
});
}
},
ready: function() {
uploadImageGallery();
}
});
就是这样