oss 上传
post 上传方式
var formData = new FormData(); that.$ajax({ url:"sign",//获取标签信息 }).then(res=>{ console.log(res); if(res.data.code == "0"){ that.resp = res.data.data; formData.append('OSSAccessKeyId',that.resp.accessId); formData.append('policy', that.resp.encodePolicy); formData.append('Signature', that.resp.signature); formData.append('success_action_status', '200'); formData.append('expire', that.resp.expire); formData.append('endpoint', 'oss-cn-beijing.aliyuncs.com'); formData.append('callbackbody', that.resp.callbaclBody); let name = file.name; formData.append("key",name); formData.append("file",file); console.log(formData.get("OSSAccessKeyId")); that.$ajax({ method:"POST", url:that.resp.host, headers:{ 'Content-Type': 'multipart/form-data', }, data: formData }).then(res=>{ console.log(res); if(that.imgIndex == 0){ that.articleData.reprintProof = name; that.reprintName = name; }else if (that.imgIndex == 1) { that.articleData.img = name; }else{ that.smallPhoto = "https://cbcnag.aliyuncs.com/"+name; } formData = new FormData() }) } })