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