路由配置 增加 fullpage 整页路由配置

This commit is contained in:
sc 2021-10-18 10:45:30 +08:00
parent f7c89bc669
commit 2ed0f5cd70
4 changed files with 45 additions and 2 deletions

View File

@ -99,7 +99,7 @@
},
//tag
addViewTags(route) {
if(route.name){
if(route.name && !route.meta.fullpage){
this.$store.commit("pushViewTags",route)
this.$store.commit("pushKeepLive",route.name)
}

View File

@ -53,7 +53,11 @@ router.beforeEach(async (to, from, next) => {
});
return false;
}
//整页路由处理
if(to.meta.fullpage){
to.matched = [to.matched[to.matched.length-1]]
}
//加载API路由
if(!isGetApiRouter){
let menu = tool.data.get("MENU");

View File

@ -0,0 +1,32 @@
<template>
<el-container>
<el-header>
<el-page-header content="FullPage" @back="goBack" />
</el-header>
<el-main>
<el-empty description="FullPageMain"></el-empty>
</el-main>
</el-container>
</template>
<script>
export default {
name: 'fullpage',
data() {
return {
}
},
mounted() {
},
methods: {
goBack(){
this.$router.go(-1)
}
}
}
</script>
<style>
</style>

View File

@ -23,6 +23,10 @@
</el-form-item>
</el-form>
</el-card>
<el-card shadow="never" header="整页路由" style="margin-top: 15px;">
<el-button type="primary" plain @click="fullpage">fullpage</el-button>
<el-alert title="变更路由的层级关系,向上推至顶级达到在layout视图中显示. 只需要在路由中设置 meta.fullpage 即可" style="margin-top: 20px;"></el-alert>
</el-card>
</el-main>
</template>
@ -66,6 +70,9 @@
},
set1(){
useTabs.setTitle(this.input)
},
fullpage(){
this.$router.push('/other/fullpage')
}
}
}