vue_demo/index.html

46 lines
1.1 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
<div style="height: 20px"></div>
<iframe src="http://localhost:5173/#/" id="iframe-demo" class="ifrom" frameborder="0"></iframe>
</body>
<style>
.ifrom {
width: 80vw;
height: 80vh;
}
</style>
<script type="application/javascript">
setTimeout(() => {
loading()
}, 2000)
function loading() {
const iframeDemo = document.getElementById("iframe-demo");
const data = {
id: "id",
name: "名称",
token: "sahidoajiodsa",
userName: "用户名",
userId: 123
};
//第一个参数是要传递给iframe的数据 第二个是传递该页面时候的url(相当于消息id)
iframeDemo.contentWindow?.postMessage(data)
}
</script>
</html>