1. el-upload
相关设置
<el-upload
class="avatar-uploader"
action="/ajax/upload_files" //上传接口
name="pic_file" //接收字段
:headers= headers //请求头设置
:show-file-list="false"
:on-success="handleAvatarSuccess" //成功回调
:before-upload="beforeAvatarUpload">
<img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
注意请求头设置
headers:{'ContentType' : 'multipart/form-data'}
网友评论