我想把我的服务器上已经存在的文件添加到Dropzone,我试着在vue-dropzone文档和普通的dropzone文档中搜索我的问题,我也尝试了5+ github的问题,并尝试了帮助方法,但我似乎没有找到解决方案。
所以我调用这个方法:
this.product.images.forEach(image => {
const file = { name: 'Icon', type: 'image/jpeg', dataURL: image };
this.$refs.dropzone.manuallyAddFile(file, image);
});
文件被正确添加,但我根本没有得到任何缩略图生成。这基本上就是整个问题所在。
发布于 2019-06-30 18:49:09
您可以使用emit
手动添加缩略图:
this.product.images.forEach(image => {
const file = { name: 'Icon', type: 'image/jpeg', dataURL: image };
this.$refs.dropzone.manuallyAddFile(file, image);
this.$refs.dropzone.dropzone.emit('thumbnail', file, file.dataURL)
this.$refs.dropzone.dropzone.emit('complete', file)
});
如果你的推荐人是dropzone
,你需要去this.$refs.dropzone.dropzone
。
而且您需要在@vdropzone-mounted="loadPictures"
中调用您的方法。
祝好运!
https://stackoverflow.com/questions/56827082
复制