103 lines
2.1 KiB
103 lines
2.1 KiB
1 year ago
|
<!--
|
||
|
* @Author: zbguopeng 18053314396@163.com
|
||
|
* @Date: 2022-06-23 11:07:04
|
||
|
* @LastEditors: Praise-Sun 18053314396@163.com
|
||
|
* @LastEditTime: 2022-09-27 20:23:48
|
||
|
* @FilePath: \tunnel-ui\src\layout\components\AppMain.vue
|
||
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||
|
-->
|
||
1 year ago
|
<template>
|
||
1 year ago
|
<section :class="getRoute2($route.path)?'appMainIndex':'app-main'" >
|
||
1 year ago
|
<transition name="fade-transform" mode="out-in">
|
||
|
<keep-alive :include="cachedViews">
|
||
|
<router-view :key="key" />
|
||
|
</keep-alive>
|
||
|
</transition>
|
||
|
</section>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
1 year ago
|
import TopNav from "@/components/TopNav";
|
||
1 year ago
|
export default {
|
||
1 year ago
|
name: "AppMain",
|
||
1 year ago
|
components: {
|
||
1 year ago
|
TopNav,
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
path: "",
|
||
|
};
|
||
1 year ago
|
},
|
||
1 year ago
|
computed: {
|
||
|
cachedViews() {
|
||
1 year ago
|
// debugger
|
||
|
console.log(this.$store.state.tagsView.cachedViews)
|
||
|
return this.$store.state.tagsView.cachedViews;
|
||
1 year ago
|
},
|
||
|
key() {
|
||
1 year ago
|
this.path = this.$route.path;
|
||
|
return this.$route.path;
|
||
1 year ago
|
},
|
||
|
topNav: {
|
||
|
get() {
|
||
1 year ago
|
// debugger
|
||
|
console.log(this.$store.state.settings.topNav)
|
||
|
return this.$store.state.settings.topNav;
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
methods:{
|
||
|
getRoute2(path){
|
||
|
var arr = [
|
||
|
"/index",
|
||
|
"/map/map/index",
|
||
|
"/emergency/administration/dispatch",
|
||
|
"/map/map3d/index",
|
||
|
"/energy",
|
||
|
];
|
||
|
if (arr.includes(path)) {
|
||
|
return true;
|
||
|
} else {
|
||
|
return false;
|
||
1 year ago
|
}
|
||
1 year ago
|
},
|
||
1 year ago
|
}
|
||
1 year ago
|
};
|
||
1 year ago
|
</script>
|
||
|
|
||
|
<style lang="scss" scoped>
|
||
|
.app-main {
|
||
|
/* 50= navbar 50 */
|
||
1 year ago
|
// height: calc(100vh - 107px) !important;
|
||
1 year ago
|
width: 100%;
|
||
|
position: relative;
|
||
1 year ago
|
// 顶部
|
||
|
// overflow: hidden;
|
||
1 year ago
|
}
|
||
|
|
||
1 year ago
|
.fixed-header + .app-main {
|
||
1 year ago
|
// padding-top: 50px;
|
||
1 year ago
|
}
|
||
|
|
||
|
.hasTagsView {
|
||
|
.app-main {
|
||
1 year ago
|
/* 84 = navbar + tags-view = 50 + 34 */
|
||
|
// height: 100%;
|
||
|
// overflow: hidden;
|
||
1 year ago
|
}
|
||
|
|
||
1 year ago
|
.fixed-header + .app-main {
|
||
1 year ago
|
// padding-top: 84px;
|
||
1 year ago
|
}
|
||
|
}
|
||
|
</style>
|
||
|
|
||
|
<style lang="scss">
|
||
|
// fix css style bug in open el-dialog
|
||
|
.el-popup-parent--hidden {
|
||
|
.fixed-header {
|
||
|
padding-right: 17px;
|
||
|
}
|
||
|
}
|
||
|
</style>
|