我写react项目,同时有一个静态html页面需要展示,我在组件中用a标签指向html,却访问不了,请问该如何访问?
通过 iframe引入。亲测可行。
``
import data from './data.html'; // 引入需要引用的html文件
class Data extends Component {
render() {
return (
<iframe
title="resg"
srcDoc={data}
style={{ width: '100%', border: '0px', height: '1100px' }}
sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
scrolling="auto"
/>
);
}
}
export default withRouter(Data);
``
4 回答1.7k 阅读
2 回答1.1k 阅读✓ 已解决
2 回答2.6k 阅读
1 回答962 阅读✓ 已解决
1 回答689 阅读✓ 已解决
2 回答852 阅读✓ 已解决
2 回答1k 阅读
这个提示表明,你的路径设置有问题。检查一下路径。