From b6659f5ae9e2d74dc8cc9662fc553c3f83ecff08 Mon Sep 17 00:00:00 2001 From: hongawen <83944980@qq.com> Date: Thu, 10 Oct 2024 11:29:48 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BE=AE=E8=B0=83=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B0=81=E8=A3=85=E7=9A=84Axios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts index 85679fb..e459224 100644 --- a/frontend/src/api/index.ts +++ b/frontend/src/api/index.ts @@ -18,13 +18,15 @@ const config = { // 设置超时时间 timeout: ResultEnum.TIMEOUT as number, // 跨域时候允许携带凭证 - withCredentials: true + withCredentials: true, + // post请求指定数据类型以及编码 + headers: { 'Content-Type': 'application/json;charset=utf-8' } }; class RequestHttp { service: AxiosInstance; public constructor(config: AxiosRequestConfig) { - // instantiation + // 创建实例 this.service = axios.create(config); /**