整合前端
This commit is contained in:
39
ruoyi-ui/test/parent.html
Normal file
39
ruoyi-ui/test/parent.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>父窗口 - 发送消息</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<iframe src="http://localhost/index" frameborder="0"></iframe>
|
||||
|
||||
<script>
|
||||
const iframe = document.querySelector('iframe');
|
||||
|
||||
// 等待iframe加载完成
|
||||
iframe.onload = function () {
|
||||
// 发送字符串消息
|
||||
// iframe.contentWindow.postMessage('hello', 'http://localhost');
|
||||
|
||||
// 发送对象消息
|
||||
// const complexData = {
|
||||
// type: 'greeting',
|
||||
// message: '你好',
|
||||
// timestamp: new Date().getTime()
|
||||
// };
|
||||
// iframe.contentWindow.postMessage(complexData, 'http://localhost');
|
||||
|
||||
const loginData = {
|
||||
type: 'token',
|
||||
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOiJzeXNfdXNlcjoxIiwicm5TdHIiOiJsMjhkSkc3ZGh1Zlp0VWl5eE1PVlFqNWFXclU4ODJHSCIsInVzZXJJZCI6MX0.O4RYVn_H3CCtqBdVkB26Qo-_8MMvhBTTDDri3V7TeQI',
|
||||
redirect: '/finance/profit'
|
||||
};
|
||||
iframe.contentWindow.postMessage(loginData, 'http://localhost');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user