Bootstrap

Vue处理后端返回文件流实现下载

Vue处理后端返回文件流实现下载文件到本地

1、在项目src目录utils下编写一个download.js文件

export default {
   
		//下载Excel
	excel(data,fileName) {
   
		this.download0(data,fileName,"application/vnd.ms-excel");
	},
		//下载docx
	docx(data,fileName) {
   
		this.download0(data,fileName,"application/msexcel");
	},
		//下载Word
	word(data,fileName) {
   
		this.download0(data
;