打字稿似乎在这里对我不利。这是我想要嵌入的内容:
<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/BLAH?showinfo=0"
frameBorder="0"
allow="autoplay; encrypted-media"
allowFullScreen></iframe>
问题是allow
属性:
TS2339: Property 'allow' does not exist on type 'DetailedHTMLProps<IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>'.
...这是真的,它不在index.d.ts中。我如何强行添加此属性,或以某种方式将iframe
强制转换为任何类型等?
答案是将属性从allow
更改为data-allow
。