我想在代码中放入一些HTML文件,如下所示
<FlexContent gap="16" justify="space-between">
<iframe src="../../public/assets/maps/cityMap.html" frameborder="0"></iframe>
</FlexContent>
这个文件是一个交互式Map,它有HTML,脚本和SVG在一起,我想显示它,但它不工作,谢谢
- 我导入了元素
- 已尝试使用
getStaticProps
export const getStaticProps = async (ctx) => {
// your fetch function here
const data = await fetch("../../public/assets/maps/cityMap.html");
return {
props: {},
};
};
我有这个错误:
Failed to parse URL from "../../public/assets/maps/cityMap.html"
1条答案
按热度按时间ggazkfy81#
使用react-iframe库在iframe中显示html
https://www.npmjs.com/package/react-iframe