如何使用dropzone&vueJs
how upload file using dropzone & vueJs
请帮帮我
我正在使用DropzoneJs&vueJs,我想用dropzone.js在vueJs中上传文件,但不起作用,我试过这样&消息错误
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();
}
});
- 将函数移动到方法中,以便可以通过
this
访问vm - 使用
new Dropzone()
而不是$().dropzone?
创建Dropzone实例 - 将新实例保存为vm属性,而不是变量
- 通过该属性以其他方法访问它
像这样:
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();
}
});
就是
相关文章:
- jquery点击函数select&取消选择
- Windows8应用程序(html&Javascript):从图片库(除了文件选择器)显示图像的另一种方式
- Angular js-返回一个包含类似
- 一点javascript元编程&可链接的设置器
- 通过JSON&比较时间
- Jquery模板,如果xx&&如果yy
- jQuery工具验证器自定义效果-添加&消除影响
- Twitter引导程序Typeahead-Id&标签
- AngularJS&JSON-从Previous&下一个对象
- 什么是&&在没有if的行中的变量之间
- 关于引入外部javascript文件的问题&css通过https
- 指令的模板必须只有一个根元素:With restrict E&替换true
- 使用ajax的服务器端分页&jQuery
- Javascript,如果条件在没有&&逻辑运算符当&&它不起作用
- 如何使用dropzone&vueJs
- 如何准确执行加载脚本&退出弹出窗口
- 如何添加CSS&JavaScript进入Windows窗体应用程序C#.net
- Solr查询以按日期月份获取数据&年
- 显示&作为&在jsp中使用angularjs而不使用ng-bind-html
- 在vuejs中呈现具有重复值的数组