diff --git a/components/Image/image.tsx b/components/Image/image.tsx index 4e07ac33bd..a7cbbf5e14 100644 --- a/components/Image/image.tsx +++ b/components/Image/image.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useEffect, useMemo, LegacyRef, useRef } from 'react'; +import React, { useContext, useEffect, useMemo, LegacyRef, useRef, SyntheticEvent } from 'react'; import cs from '../_util/classNames'; import { ConfigContext } from '../ConfigProvider'; import IconLoading from '../../icon/react-icon/IconLoading'; @@ -114,7 +114,7 @@ function Image(baseProps: ImagePropsType, ref: LegacyRef) { const refImg = useRef(); - function onImgLoaded(e) { + function onImgLoaded(e: SyntheticEvent) { loaded.current = true; setStatus('loaded'); onLoad && onLoad(e); diff --git a/components/Image/interface.ts b/components/Image/interface.ts index 8e3b93c826..7197cb1944 100644 --- a/components/Image/interface.ts +++ b/components/Image/interface.ts @@ -1,4 +1,11 @@ -import { CSSProperties, ReactNode, HTMLAttributes, ImgHTMLAttributes, ReactElement } from 'react'; +import { + CSSProperties, + ReactNode, + HTMLAttributes, + ImgHTMLAttributes, + ReactElement, + SyntheticEvent, +} from 'react'; /** * @title Image @@ -89,12 +96,12 @@ export interface ImageProps extends Omit, 'c * @zh 图片加载完成时触发 * @en Triggered when the image is loaded */ - onLoad?: (ev: Event) => void; + onLoad?: (ev: SyntheticEvent) => void; /** * @zh 图片加载失败时触发 * @en Triggered when image loading fails */ - onError?: (ev: Event) => void; + onError?: (ev: SyntheticEvent) => void; } /**