Vue.js 从dropzone.js参数访问数据属性-vuejs
我正在尝试从dropzoneOption访问at数据参数,如下所示:Vue.js 从dropzone.js参数访问数据属性-vuejs,vue.js,parameters,dropzone.js,Vue.js,Parameters,Dropzone.js,我正在尝试从dropzoneOption访问at数据参数,如下所示: data() { return { e1: 0, dropzoneOptions: { url: '/api/imageUpload', thumbnailWidth: null, thumbnailHeight: null, acceptedFiles: '.jpg, .jpeg, .png', autoProcessQueue: false,
data() {
return {
e1: 0,
dropzoneOptions: {
url: '/api/imageUpload',
thumbnailWidth: null,
thumbnailHeight: null,
acceptedFiles: '.jpg, .jpeg, .png',
autoProcessQueue: false,
previewsContainer: '.preview-container',
init: function() {
this.on("addedfile", function(file) {
//Access to e1 params.
//This.e1 not working
});
},
}
}
},
有没有办法从函数内部访问它?您是否尝试过这样编写它:
init:function(){
const _this=this//将其作为变量赋值
this.on(“addedfile”,函数(文件){
log(“添加的文件”,文件);
console.log(_this.e1)
});
}
使用@vdropzone file added=“filedAdded”并声明名为filledded的方法解决。非常感谢。