一、在main.js中定义一个公共的方法
// method: 传参方式get或post
// url:接口地址
// name: 下载文件名
//key: 本项目中的使用情况 可不要
// data: 需要的传参数据(一般get不需要)
const exportExsl = (method,url,name,key = 'BASE_URL',data = {
})=>{
fetch(`http://${
window.online_config[key] + url}`,{
method,
responseType