且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么React.js会删除< img />上的srcset标记?

更新时间:2023-09-29 22:15:16

解决方案是使用 srcSet 而不是 srcset

The solution is to use srcSet instead of srcset.

<img src="/images/logo.png" srcSet="/images/logo-1.5x.png 1.5x, /images/logo-2x.png 2x" />

参考: https://facebook.github.io/react/docs/tags-and-attributes.html c $ c> HTML属性

Reference: https://facebook.github.io/react/docs/tags-and-attributes.html under HTML Attributes