使用element的upload组件自定义上传方法,使用:http-request
<el-upload
action=""
:http-request="uploadRequest">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
- 由于action为必选参数,将其设为空
- :http-request覆盖上传方法
- 使用:http-request后,:on-success等组件自带方法都会失效,需要在接口.then或.catch中写上传成功或失败的逻辑