• 【angular5项目积累总结】文件上传


    <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/

  • 相关阅读:
    求阴影部分的面积
    论语(原文注音, 注释, 译文, 评析) 打印版
    生肖故事
    北京大学2019年高等代数考研试题
    LaTeX技巧561:LaTeX如何让每一章带有目录?
    用 Mathematica 获取图片的 RGB 三基色
    tex 进度条
    跟锦数学190314
    Beamer 目录分栏
    Beamer 跳到另外一页
  • 原文地址:https://www.cnblogs.com/sybboy/p/10564797.html
Copyright © 2020-2023  润新知