From 4c3df301a0826ba0379e54cb21512be09fe0c166 Mon Sep 17 00:00:00 2001 From: hailin Date: Tue, 29 Jul 2025 23:37:55 +0800 Subject: [PATCH] . --- php_pc/src/utils/http/index.ts | 4 ++-- php_pc/src/utils/http/request.ts | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/php_pc/src/utils/http/index.ts b/php_pc/src/utils/http/index.ts index 44bc99d..05d9c28 100644 --- a/php_pc/src/utils/http/index.ts +++ b/php_pc/src/utils/http/index.ts @@ -1,6 +1,6 @@ // import { FetchOptions, $fetch } from "ofetch"; -import ofetch from "ofetch"; -import type { FetchOptions } from "ofetch"; // 👈 用 `type` 引入类型 +import { ofetch } from "ofetch"; // ✅ 正确,没有 default,只能这样导入 +import type { FetchOptions } from "ofetch"; // ✅ 类型也正确 const $fetch = ofetch; import { RequestCodeEnum, RequestMethodsEnum } from "@/enums/requestEnums"; import feedback from "@/utils/feedback"; diff --git a/php_pc/src/utils/http/request.ts b/php_pc/src/utils/http/request.ts index 0c9ed64..9353a7d 100644 --- a/php_pc/src/utils/http/request.ts +++ b/php_pc/src/utils/http/request.ts @@ -12,17 +12,16 @@ // RequestEventStreamOptions, // } from "ofetch"; -import ofetch from "ofetch"; +import { ofetch } from "ofetch"; // ✅ 没有 default export import type { FetchOptions, FetchResponse, RequestOptions, FileParams, - RequestEventStreamOptions + RequestEventStreamOptions, } from "ofetch"; -const $fetch: typeof ofetch = ofetch; -type $Fetch = typeof ofetch; +const $fetch = ofetch; // ✅ 手动绑定 import { merge } from "lodash-es"; import { isFunction } from "../validate";