fix router
This commit is contained in:
1 parent
8088538589
commit
c6a962a089
8 files changed
+46
-45
No files matched your search
+34
-5
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<el-container class="h-screen">
|
||||
<el-container :class="showFullHeight ? 'h-screen' : ''">
|
||||
<el-header>
|
||||
<top-header />
|
||||
</el-header>
|
||||
<el-container>
|
||||
<el-aside width="250px">
|
||||
<el-aside width="250px" v-if="showSidebar">
|
||||
<sidebar />
|
||||
</el-aside>
|
||||
<el-main>
|
||||
@@ -17,13 +17,42 @@
|
||||
<script lang="ts">
|
||||
import Sidebar from '@/components/content/Sidebar.vue';
|
||||
import { TopHeader } from '@/components/common/index';
|
||||
export default {
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
interface IData {
|
||||
routes: {
|
||||
detail: string[];
|
||||
};
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
TopHeader,
|
||||
Sidebar
|
||||
},
|
||||
name: 'LayoutContent'
|
||||
};
|
||||
data(): IData {
|
||||
return {
|
||||
routes: {
|
||||
detail: ['article-detail']
|
||||
}
|
||||
};
|
||||
},
|
||||
name: 'LayoutContent',
|
||||
computed: {
|
||||
showSidebar(): boolean {
|
||||
console.log('router', this.$route.name);
|
||||
return !this.isDetailRoute();
|
||||
},
|
||||
showFullHeight(): boolean {
|
||||
return !this.isDetailRoute();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isDetailRoute(): boolean {
|
||||
return this.routes.detail.includes(this.$route.name?.toString() || '');
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in new issue
Block a user