api.js
export async function getResponsesExcel(url, params) { const response = await fetch(urlPrefix + url, { method: "POST", credentials: "include", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: params }).catch((error) => { console.log(error) }) return await response.blob().catch((error) => { console.error(error) })}export const serialize = (obj) => { // let str = "" // for (let key in obj) { // str += `${key}=${encodeURIComponent(obj[key])}&` // } // str = str.slice(0, -1) // return str return Object.keys(obj).map((item) => `${ encodeURIComponent(item)}=${ encodeURIComponent(obj[item])}`).join("&")}复制代码
.vue文件中