<div class="form-group row"> <label class="col-sm-2 col-form-label">会议Logo</label> <div class="col-sm-10"> <dx-file-uploader selectButtonText="选择图片" name="file" [multiple]="false" labelText="" [uploadUrl]="uploadImgUrl" uploadMode = "instantly" (onUploaded)="onUploadSuccess($event,0)" accept="image/*"> </dx-file-uploader> </div> </div>
onUploadSuccess(event: any, type:any) { console.log(event); if (event.request.readyState == 4 && event.request.status == 200 && event.request.response) { let responseObj = JSON.parse(event.request.response); let _url = responseObj['url']; let _blockblobName = responseObj['blockblobName']; if (!!_url && type == 0) { this.meetingObj['Logo'] = _url; } if (_url && _blockblobName && type >= 0) { let _mark = 0; this.uploadFileArray.map((item, index) => { if (item.type == type) { _mark = 1; this.uploadFileArray[index]['url'] = _url; this.uploadFileArray[index]['fileName'] = _blockblobName; } }); !_mark && this.uploadFileArray.push({ type: type, url: _url, fileName: _blockblobName}); } }
组件地址:https://js.devexpress.com/Demos/WidgetsGallery/Demo/FileUploader/FileUploading/Angular/Light/