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