You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

163 lines
3.8 KiB

<template>
<div id="app">
<!-- <nav>
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link> |
<router-link to="/ui">组件示例文件</router-link>
</nav> -->
<!-- <router-view/> -->
<el-container>
<el-header style="height: 62px;" v-if="showHeader">
<Header></Header>
<video class="top_viedo" width="100%" src="./assets/headerBg1.mp4" autoplay loop muted
></video>
<div class="bg"></div>
</el-header>
<el-container :class="(showHeader ? 'short-container' : '')">
<SliderMenu v-if="showSidebar"></SliderMenu>
<el-container>
<!-- 面包屑导航 -->
<Breadcrumb />
<el-main class="app-content">
<global-loading>
<router-view />
</global-loading>
</el-main>
<!-- <el-footer v-if="showFooter">
<Footer></Footer>
</el-footer> -->
</el-container>
</el-container>
</el-container>
</div>
</template>
<script>
import SliderMenu from '@/components/SliderMenu.vue';
// import Footer from '@/components/Footer.vue';
import { mapState } from 'vuex';
import Header from './components/Header.vue';
import Breadcrumb from './components/Breadcrumb.vue';
// import loadingAnimation from '@/assets/loadingAni.json' // 导入JSON文件
import GlobalLoading from '@/components/GlobalLoading1.vue'
// import ContentWithLoading from '@/components/ContentWithLoading'
export default {
data() {
return {
isCollapse: true,
menuData: [
{
index: '1',
title: '父级菜单1',
icon: 'el-icon-location',
children: [
{ index: '1-1', title: '子级菜单1-1', path: '/' },
{ index: '1-2', title: 'ui页面', path: '/ui' }
]
},
{
index: '2',
title: '父级菜单2',
icon: 'el-icon-menu',
children: [
{ index: '2-1', title: '子级菜单2-1', path: '/about' },
{ index: '2-2', title: '加盟耶main', path: '/franchise' }
]
}
]
};
},
components: {
GlobalLoading,
// ContentWithLoading,
SliderMenu,
// Footer,
Header,
Breadcrumb
},
computed: {
...mapState(['showSidebar', 'showFooter', 'showHeader']) // 从Vuex映射showSidebar状态到组件的计算属性中
},
mounted() {
window.addEventListener('beforeunload', this.clearStorage);
},
beforeUnmount() {
window.removeEventListener('beforeunload', this.clearStorage);
},
methods: {
clearStorage() {
// 或按需清除特定项:
localStorage.removeItem('date');
},
handleOpen(key, keyPath) {
console.log(key, keyPath);
},
handleClose(key, keyPath) {
console.log(key, keyPath);
}
}
}
</script>
<style lang="scss" scoped>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
font-family: Microsoft YaHei UI;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
height: 100%;
background: #F5F7FA;
}
.app-content {
position: relative;
isolation: isolate;
}
.short-container {
height: calc(100vh - 62px);
}
::v-deep .el-container .el-main {
// padding: 12px;
}
.bg {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
background: rgba(255, 255, 255, 0.61);
z-index: 2;
}
::v-deep .el-header {
height: 62px;
overflow: hidden;
position: relative;
box-sizing: border-box;
background: linear-gradient(270deg, #4EA4F3 0%, #3D85EA 100%);
}
.top_viedo {
width: 100%;
height: 100%;
position: absolute;
object-fit: cover;
left: 0;
top: 0;
}
nav {
padding: 30px;
a {
font-weight: bold;
color: #2c3e50;
&.router-link-exact-active {
color: #42b983;
}
}
}
</style>