el-upload 文件上传

本文介绍了el-upload组件的使用方法,包括设置上传文件的字段名、类型限制、上传地址、是否支持多文件上传、是否自动上传等属性。同时,讲解了如何处理文件上传前后的操作,如before-upload、on-success、on-error等回调函数,以及如何设置上传请求的头部信息和额外参数。此外,还提到了如何在文件上传成功后清除文件列表,确保下一次上传时不会显示旧文件。
摘要由CSDN通过智能技术生成
<div class="upload-active">
          <el-upload
            name="file"
            accept=".docx"
            action="/api/file"
            ref="uploadref"
            :multiple="false"
            :auto-upload="true"
            :show-file-list="true"
            :before-upload="beforeUpload"
            :on-success="handleSuccess"
            :on-error="handleError"
            :headers="myHeaders"
            :before-remove="beforeRemove"
            :on-remove="handelRemove"
            :data="type" >
            <div
              v-if='!isDisabled'
              class="upload-pdf-btn">
              上传 文件
            </div>
          </el-upload>
        </div>

name:上传的文件字段名;
accept:限制文

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值