mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 19:36:43 +08:00
测试
This commit is contained in:
@@ -30,20 +30,16 @@ import portalFooter from "@/components/PortalFooter.vue";
|
||||
window.addEventListener('message', this.handleMessageFromChild);
|
||||
},
|
||||
beforeDestroy() {
|
||||
// 移除事件监听器
|
||||
window.removeEventListener('message', this.handleMessageFromChild);
|
||||
},
|
||||
methods:{
|
||||
handleMessageFromChild(event) {
|
||||
console.log(event,'我进来了')
|
||||
if (event.origin !== process.env.VUE_APP_BOE_MOBILE_URL) return; // 验证来源以防跨站脚本攻击
|
||||
if (event.origin !== process.env.VUE_APP_BOE_MOBILE_URL) return;
|
||||
if (event.data && event.data.type === 'navigate') {
|
||||
this.navigate(event.data.path);
|
||||
}
|
||||
},
|
||||
navigate(path) {
|
||||
// 清除查询参数
|
||||
// 这里假设iframe加载的是子项目,可以通过改变iframe的src属性来导航
|
||||
this.$router.push({
|
||||
path:path
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user