【问题标题】:How can I insert HTML data in iframe in React?如何在 React 的 iframe 中插入 HTML 数据?
【发布时间】:2022-11-12 03:59:16
【问题描述】:

如何在 iframe 中插入“html”数据?

const Xcomponent = () => {

//$(iframe).contents().find('body').html( "<div> Hello </div>" )
    return (
    
{stateTheme.data && stateTheme.htmls.map( ( html, index)=> {
   return(<div> <iframe> </iframe> </div>)
})}

};

在静态 html 中,我可以使用此代码插入 $(iframe).contents().find('body').html( "&lt;div&gt; Hello &lt;/div&gt;" ),我在这里寻找相同的结果

【问题讨论】:

    标签: javascript html jquery reactjs


    【解决方案1】:

    您可能可以制作一个新组件并在那里完成所有工作,当您拥有 jsx 时,在 react 中插入字符串 html 似乎很奇怪

    【讨论】:

      猜你喜欢
      • 2011-02-16
      • 2020-08-29
      • 2013-05-19
      • 1970-01-01
      • 2016-03-03
      • 1970-01-01
      • 2020-11-15
      • 2016-10-30
      • 2016-10-02
      相关资源
      最近更新 更多