vue文件导出文件

//准备
npm install js-file-download --save

//使用
export function download(val) {
  return flies({
    url: "/assets/exportAssets",
    method: "get",
    params: val,
    responseType: "blob",
  });
}


//页面使用
import { download } from './index.js'
import fileDownload from "js-file-download";


let obj =  //你的参数 ,可不传;
download(obj).then((res) => {
  fileDownload(res.data, "资产数据.xlsx");
});

//如果有问题,检查自己的拦截器这块是否存在问题

  

posted @ 2022-05-23 10:25  小万子呀  阅读(195)  评论(0编辑  收藏  举报