iframe src 属性在我的 React 应用程序中更改为 data-src

iframe src attribute is changing into data-src in my React application

在 React 组件中我有一个 iframe:

<iframe
  css={styles.videoIframe}
  width="853"
  height="480"
  src={embedlink}
  frameBorder="0"
  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
  allowFullScreen
  title={title}
/>

当我检查 DOM 时,我看到 src 已更改为 data-src?

<iframe width="853" height="480" data-src="http://www.youtube.com/embed/youtube-id-here" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" title="The title"></iframe>

我没有看到呈现的嵌入式 YouTube 视频?可能是因为将属性更改为 data-src?

我最终为此使用了无 cookie 嵌入。将我的嵌入变量更改为:

后它工作正常
const embedLink = `https://www.youtube-nocookie.com/embed/${youtubeId}`;

另请参阅 答案。