Vue Project Download Form Java background returned is the information flow table how to download solve garbled

Source: Internet
Author: User

Mainly after the request parameter is appended {responsetype: ' blob '}
this. $http. Get (This.api.export, {
Params:this.info,
Responsetype: ' blob '
}). Then (res = {
Let blob = new blob ([Res.data], {type: "application/vnd.ms-excel"});
Let Objecturl = Url.createobjecturl (BLOB);
Window.location.href = Objecturl;
})

-----

1. Sometimes, the front page needs to show the backend interface returned to us a binary file, compared to the slice, then how should we download it?

JS has a Blob object, a Blob object that represents a similar file object that is immutable, raw data. The blob representation of the data is not necessarily a JavaScript native format Blob object is essentially an object in JS, which can store a large number of binary encoded format data.

2. Create a Blob object

var debug = {hello: "World"};

var blob = new blob ([' Backend binary ' returned '],{type: ' What type of file (MIME) ' is the file);

3. Commonly used file type has (MIME), according to need to return what kind of file, just fill in what kind of MIME type, also can not write, write to specify the download file format, do not write, what file format, download is what format, according to project needs.

suffix-name MIME name
*.3GPP AUDIO/3GPP, VIDEO/3GPP
*.AC3 AUDIO/AC3
*.ASF allpication/vnd.ms-asf
*.au Audio/basic
*.css Text/css
*.csv Text/csv
*.doc Application/msword
*.dot Application/msword
*.DTD APPLICATION/XML-DTD
*.DWG IMAGE/VND.DWG
*.DXF IMAGE/VND.DXF
*.gif Image/gif
*.htm text/html
*.html text/html
*.JP2 IMAGE/JP2
*.jpe Image/jpeg
*.jpeg Image/jpeg
*.jpg Image/jpeg
*.js Text/javascript, Application/javascript
*.json Application/json
*.MP2 Audio/mpeg, Video/mpeg
*.mp3 Audio/mpeg
*.mp4 Audio/mp4, Video/mp4
*.mpeg Video/mpeg
*.mpg Video/mpeg
*.mpp Application/vnd.ms-project
*.ogg Application/ogg, Audio/ogg
*.pdf application/pdf
*.png Image/png
*.pot Application/vnd.ms-powerpoint
*.pps Application/vnd.ms-powerpoint
*.ppt Application/vnd.ms-powerpoint
*.rtf Application/rtf, Text/rtf
*.SVF IMAGE/VND.SVF
*.tif Image/tiff
*.tiff Image/tiff
*.txt Text/plain
*.wdb Application/vnd.ms-works
*.wps Application/vnd.ms-works
*.xhtml Application/xhtml+xml
*.XLC Application/vnd.ms-excel
*.XLM Application/vnd.ms-excel
*.xls application/vnd.ms-excel
*.xlt Application/vnd.ms-excel
*.XLW Application/vnd.ms-excel
*.xml Text/xml, Application/xml
*.zip Aplication/zip

*.xlsx Application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

Vue Project Download Form Java background returned is the information flow table how to download solve garbled

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.