From 6b32edd9c4af29c7e68d0f29bc153adc81ef698b Mon Sep 17 00:00:00 2001 From: kylin L <452061493@qq.com> Date: Sun, 5 May 2024 23:55:17 +0800 Subject: [PATCH] =?UTF-8?q?http.js=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/http/http.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/http/http.js b/src/http/http.js index 64c4927..409acea 100644 --- a/src/http/http.js +++ b/src/http/http.js @@ -3,10 +3,12 @@ import { $globalStore } from "../common/globalStore" // import router from '@/router/home'; // import {cache} from '@/store/store'; axios.defaults.withCredentials = true +const source = axios.CancelToken.source() const http = axios.create({ traditional: true, contentType : "application/json", timeout: 1000 * 1000, // 1 秒 + cancelToken: source.token // 将cancel token添加到option请求中 }); const router = useRouter(); //请求拦截器添加head