vue项目不同的模块使用同一个上传文件按钮

                      <el-upload
                        class="upload-demo"
                        :disabled="getBtn"
                        action="#"
                        accept=".pdf,.PDF" // 限制文件上传的格式
                        :before-upload="function(file,fileList){return beforeUpload(file,fileList,index)}"
                        :http-request="function(file,fileList){return uploadFile(file,index)}"
                        :on-preview="function(file,fileList){return handlePreview(file,index)}"
                        :on-success="function(file,fileList){return handSuccess(file,fileList,index)}"
                        :on-remove="function(file,fileList){return handleRemove(file,fileList,index)}"
                        :limit="999"
                        :file-list="item.assetAttributes.filter(el => el.attrType === 'PDF')" // 绑定的数组,因为我这个是多个模块都在一个数组内部,并且有些内容不是pdf文件,数据结构比较复杂,属于是数组里面包对象再包数组,所以需要过滤。
                      >
                        <el-button type="primary">上传文件</el-button>
                        <div slot="tip" class="el-upload__tip">只能上传pdf文件</div>
                      </el-upload>
初次上传数组为空。保存以后可正常反显
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值