如何解决在 dropzone 中显示图像列表
当我在 angular 页面中加载带有 Dropzone 的组件时,我想显示 listaFotoData 中列出的一些图像。 有没有办法将它传递给 Dropzone?如何使用现有图像初始化 Dropzone?希望我已经足够清楚了。
dropzone Component containing dropzone
我发现将其放入 dropzone 配置中,
export class UploadFotoComponent implements OnInit {
@ViewChild(DropzoneComponent,{ static: false }) componentRef?: DropzoneComponent;
@ViewChild(DropzoneDirective,{ static: false }) directiveRef?: DropzoneDirective;
@Output() fotoUploaded: EventEmitter<number> = new EventEmitter<number>();
@Output() fotoRemoved: EventEmitter<number> = new EventEmitter<number>();
@Input() listaFotoData;
fotoName: any;
public config: DropzoneConfigInterface = {
clickable: true,maxFiles: 10,autoReset: null,errorReset: null,cancelReset: null,addRemoveLinks: true,dictRemoveFile: 'Rimuovi',dictDefaultMessage : "Clicca qui o trascina l'immagine da caricare.",init: function() {
let myDropzone = this;
**let mockFile = { name: "Filename 2",size: 12345 };**
myDropzone.displayExistingFile(mockFile,"https://i.picsum.photos/id/959/600/600.jpg");
}
};
但是如何从模拟文件切换到我的照片列表 listaFotoData?
编辑: 我设法将列表传递给包含 dropzone 的组件,但它在组件的 OnInit 之前被初始化,因此我无法传递该列表,因为它仍未定义。 Dropzone 是否可以选择在 init 之后传递列表?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。