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:
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="box" :class="{ incl: url.includes('projectdetails') }">
|
<div class="box" :class="{ incl: url.includes('projectdetails') }">
|
||||||
<portal-header style="background: #387DF7;" :hideSearch="true" textColor="#ffffff"></portal-header>
|
<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>
|
<portal-footer></portal-footer>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -27,9 +27,29 @@ import portalFooter from "@/components/PortalFooter.vue";
|
|||||||
if(params){
|
if(params){
|
||||||
this.url=this.url+'?'+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:{
|
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>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user