【发布时间】:2018-09-21 07:09:53
【问题描述】:
有我在打字稿中使用图像标签的代码
<img
className="mediaImg"
src={imageUrl}
onload={() => console.log('dffffffffffffffffffffffff')}
style={{ ...theme.messages.mediaImg }}
/>
当我在那里使用onload 属性时,我得到了错误
Property 'onload' does not exist on type 'DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>'
任何帮助将不胜感激!!! 谢谢
【问题讨论】:
-
我认为这只是一个错字
onLoad(带有上L) -
然后我得到这个
Type 'void' is not assignable to type '((event: SyntheticEvent<HTMLImageElement>) => void) | undefined'.
标签: reactjs typescript react-tsx