diff --git a/packages/hooks/src/useRequest/src/Fetch.ts b/packages/hooks/src/useRequest/src/Fetch.ts index 9253bd72fd..0fa3c0b338 100644 --- a/packages/hooks/src/useRequest/src/Fetch.ts +++ b/packages/hooks/src/useRequest/src/Fetch.ts @@ -11,7 +11,7 @@ import type { TempConfig, } from './types'; import { Trigger } from './types'; -import { omit } from 'lodash-es'; +import { pick, keys } from 'lodash-es'; const getDefaultTempConfig: () => TempConfig = () => ({ trigger: undefined, @@ -56,7 +56,10 @@ export default class Fetch { this.tempConfig = { ...this.tempConfig, // 不允许修改触发器类型 - ...omit(config, 'trigger'), + ...pick( + config, + keys(getDefaultTempConfig()).filter((key) => key !== 'trigger'), + ), }; } getTempConfig(key: keyof TempConfig | undefined) {