el-upload修改action属性值的接口请求头

 关键代码:

 :headers="headerObj" 

//html
<el-upload
            class="avatar-uploader"
            action="/api/xxx/xxxxx"
            :headers="headerObj"  //关键代码
            :show-file-list="false"
            :on-success="handleAvatarSuccess"
            :on-error="handleAvatarError"
            :before-upload="beforeAvatarUpload"
          >
            <img
              v-if="imageUrl"
              :src="imageUrl"
              class="avatar"
              alt="头像信息"
            />
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>

//js部分
headerObj["user-info"]="11111"

猜你喜欢

转载自blog.csdn.net/weixin_45294459/article/details/127264677