zoukankan      html  css  js  c++  java
  • 如何在react里嵌入iframe?

    无法访问iframe地址

    index.js文件

    import React from 'react';
    import ReactDOM from 'react-dom';
    import App from './App';
    
    ReactDOM.render(<App />, document.getElementById('root'));
    

    App.js

    import React from 'react'
    
    class App extends React.Component {
        render() {
            return (
                <div>
                    <h1>Outside iFrame</h1>
                    <iframe title="myiframe" src="./target.html" width="600px" height="400px"></iframe>
                </div>
            )
        }
    }
    
    export default App

    target.html

    <html>
    
    <head></head>
    
    <body>
        <h1>Inside IFrame</h1>
    </body>
    
    </html>

    index.html

    <div id="root"></div>

    为什么引入的是

    <iframe title="myiframe" src="./target.html" width="600px" height="400px"></iframe>
  • 相关阅读:
    sql推断时间
    COCOFrame
    第41周一
    第40周日
    第40周六
    第40周五
    第40周四
    第40周三国庆
    第40周二晚
    第40周二
  • 原文地址:https://www.cnblogs.com/zccst/p/8059533.html
Copyright © 2011-2022 走看看