mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-08 02:16:43 +08:00
Merge branch 'zcwy-master' into dev0515
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="box" :class="{ incl: url.includes('projectdetails') }">
|
||||
<portal-header style="background: #387DF7;" :hideSearch="true" textColor="#ffffff"></portal-header>
|
||||
<iframe :src="url" style="width: 100%;height: 100%;" frameborder="0"></iframe>
|
||||
<iframe :src="url" style="width: 100%;height: 100%;" frameborder="0" ref="iframe"></iframe>
|
||||
<portal-footer></portal-footer>
|
||||
</div>
|
||||
</template>
|
||||
@@ -27,9 +27,29 @@ import portalFooter from "@/components/PortalFooter.vue";
|
||||
if(params){
|
||||
this.url=this.url+'?'+params;
|
||||
}
|
||||
window.addEventListener('hashchange', this.handleHashChange);
|
||||
window.addEventListener('popstate', this.handlePopState);
|
||||
},
|
||||
beforeDestroy() {
|
||||
window.removeEventListener('hashchange', this.handleHashChange);
|
||||
window.removeEventListener('popstate', this.handlePopState);
|
||||
},
|
||||
methods:{
|
||||
|
||||
handleHashChange() {
|
||||
this.navigate();
|
||||
},
|
||||
handlePopState() {
|
||||
this.navigate();
|
||||
},
|
||||
navigate() {
|
||||
const navigatePath = new URLSearchParams(window.location.search).get('navigate');
|
||||
if (navigatePath) {
|
||||
// 清除查询参数
|
||||
window.history.replaceState({}, '', location.pathname);
|
||||
// 导航
|
||||
this.$refs.iframe.src = navigatePath;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user