Home > front end >  Vue post submission background returns the zip file, front end can I use the code to handle the docu
Vue post submission background returns the zip file, front end can I use the code to handle the docu

Time:11-04

This is the front-end code


This is the back-end code
 System. Web. HttpContext. Current Response. AddHeader (" the content - the disposition ", "legislation; Filename="+ name +" zip "); 
System. Web. HttpContext. Current. The Response. BinaryWrite (buffer);
System. Web. HttpContext. Current. The Response. Flush ();
System. Web. HttpContext. Current. The Response. The End ();



The great god how to solve

CodePudding user response:

This is my monitor front back out data

CodePudding user response:

To the individual, knot posted, send points

CodePudding user response:

No one? To send points

CodePudding user response:

I'm still not solved, please teach you download not carrying parameters

CodePudding user response:

Why delete my posts, I ask what's the matter

CodePudding user response:

Solved the same ask asked

CodePudding user response:

Brother met the same problem today, would you solved?

CodePudding user response:

The
reference 13 floor Jayrun_z reply:
brothers met the same problem today, would you solved?



Has been solved, the code below

 axios. Post (url, ResumeViewModel, {responseType: "blob"}), then (function (res) {
If (res & amp; & Res. Status==200) {

Const blob=new blob ([res. Data] and {type: 'application/VND. Ms excel -'});
Var sFM='MM - DD YYYY - hh: MM: ss';
Var df=my moment (). The format (sFM) + ";
Var fileName='resume Word data + df +' zip ';
Var fileNameStr=res. Headers [' content - disposition] + "";
Var index=fileNameStr. IndexOf ('=');
If (index & gt; 0 {
FileName=fileNameStr. Substr (index + 1);
FileName=decodeURIComponent (fileName)
}
If (that judgeIE ()) {
The navigator. MsSaveBlob (blob, fileName)
} else {
Const elink=document. The createElement method (' a ');
Elink. Download=fileName;
Elink. Style. The display='none';
Elink. Href=https://bbs.csdn.net/topics/URL.createObjectURL (blob);
Document. The body. The appendChild (elink);
Elink. Click ();
URL. RevokeObjectURL (elink. Href);//release the URL object
Document. Body. RemoveChild (elink);
}
} else {
This $message ({
The message: "download failed, please try again!" ,
Type: "warning"
});
}

That $nextTick (function () {
LoadingInstance. Close ();
});

})
  •  Tags:  
  • Ajax
  • Related