我已经安装了 dompurify react js 库并从 API 加载了所有竞争,但 API youtube URL 视频无法加载,但可以在 API 中看到。
接口:
{
"id": 5,
"name": "shahiraja",
"title": "text below as a natural lead-in to additional content. This content is a little bit l text below as a natural lead-in to ad",
"image": "/media/resources/Screenshot_from_2021-09-14_19-13-25.png",
"created_at": "2022-01-03T08:07:44.451476Z",
"body": "<p><iframe frameborder=\"0\" src=\"//www.youtube.com/embed/LNkdmyHp5Co\" width=\"640\" height=\"360\" class=\"note-video-clip\"></iframe><a href=\"https://www.youtube.com/watch?v=LNkdmyHp5Co\"></a><br></p>",
"category": 1
}
代码:
<div
class="col-md-10"
dangerouslySetInnerHTML={{ __html: sanitize(body.body) }}
></div>