96 lines
3.0 KiB
Vue
96 lines
3.0 KiB
Vue
<template>
|
||
<div class="wrapper">
|
||
<template v-if="!this.$route.meta.hideTitle"
|
||
><template v-if="!this.$route.meta.hideSidebar">
|
||
<v-head></v-head>
|
||
|
||
<v-sidebar></v-sidebar>
|
||
<div class="content-box" :class="{ 'content-collapse': collapse }">
|
||
<v-tags></v-tags>
|
||
|
||
<div class="content" :class="{'content_main':$route.path=='/edit_per_text'}">
|
||
|
||
|
||
<transition name="move" mode="out-in">
|
||
<keep-alive :include="tagsList">
|
||
<router-view></router-view>
|
||
</keep-alive>
|
||
</transition>
|
||
<el-backtop target=".content"></el-backtop>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
<template v-else>
|
||
<v-head2 :home="true"></v-head2>
|
||
<div style="width: 100%; height: calc(100% - 42px); overflow: hidden" :style="{background: bgColor}">
|
||
<div class="content" style="padding: 0; overflow: hidden">
|
||
<!-- <transition name="move" mode="out-in"> -->
|
||
<!-- <keep-alive :include="tagsList"> -->
|
||
<router-view></router-view>
|
||
<!-- </keep-alive> -->
|
||
<!-- </transition> -->
|
||
<el-backtop target=".content"></el-backtop>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</template>
|
||
<template v-else>
|
||
<div style="width: 100%; ">
|
||
<div class="content" style="padding: 0; overflow: hidden">
|
||
|
||
<router-view></router-view>
|
||
|
||
<el-backtop target=".content"></el-backtop>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import vHead from './Header.vue';
|
||
import vHead2 from './Header2.vue';
|
||
import vSidebar from './Sidebar.vue';
|
||
import vTags from './Tags.vue';
|
||
import bus from './bus';
|
||
export default {
|
||
data() {
|
||
return {
|
||
bgColor: this.$route.meta.bgColor || '#fff',
|
||
tagsList: [],
|
||
collapse: false
|
||
};
|
||
},
|
||
components: {
|
||
vHead,
|
||
vHead2,
|
||
vSidebar,
|
||
vTags
|
||
},
|
||
created() {
|
||
|
||
bus.$on('collapse-content', (msg) => {
|
||
this.collapse = msg;
|
||
localStorage.setItem('collapse', this.collapse);
|
||
});
|
||
|
||
// 只有在标签页列表里的页面才使用keep-alive,即关闭标签之后就不保存到内存中了。
|
||
bus.$on('tags', (msg) => {
|
||
let arr = [];
|
||
for (let i = 0, len = msg.length; i < len; i++) {
|
||
msg[i].name && arr.push(msg[i].name);
|
||
}
|
||
this.tagsList = arr;
|
||
});
|
||
}
|
||
};
|
||
</script>
|
||
<style scoped>
|
||
.content_main{
|
||
/* padding-right: 0 !important;
|
||
overflow-y: auto; */
|
||
|
||
|
||
}
|
||
</style>
|