antd upload 反显

631 阅读1分钟
  theme: 使用 fileList 对列表进行完全控制,若想使用自带的功能,如删除,那么必须将数据整理成如下格式:fileList: [
    {
      uid: '-1',//唯一即可
      name: 'xxx.png',
      status: 'done',//必不可少,因为该组件只显示状态为done,的数据
      url: 'http://www.baidu.com/xxx.png',
      response:{
      name:'',
      url:''
      }//二者必不可少,用于反显
    },
  ],
                :data="{upload_sysName:'flc',upload_folder:'flAttachFile'}"
                :action="apiUrl.uploadServlet"
                @change="uploadChange"
                :fileList="fileList"
                :multiple="true"
              >
                <a-button>
                  <a-icon type="upload"/>
                  选择文件
                </a-button>
              </a-upload>
getFile(obj) {
        this.show = true
        const selectParameters = {
          pageName: 'fl-attach-file',
          formName: 'searchForm',
          'flAttachFile.w_objId': obj.flTestPlan.infoId
        }
        getCommonList(selectParameters).then(res => {
          this.fileList = []
          if(res.rows.length >0){
            res.rows.forEach(item => {
              this.fileList.push({
                uid: item.flAttachFile.infoId,
                name: item.flAttachFile.attachName,
                status: 'done',
                url:item.flAttachFile.attachUrl,
               response:{
                  fileNameOld:item.flAttachFile.attachName,
                  murl:item.flAttachFile.attachUrl
                }
              })
            })
          }
 })