如何在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>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM