File size: 2,899 Bytes
2b7fd6e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
<template>
<el-container class="app-wrapper" :class="{ mobile: isMobile }">
<div v-show="isMobile && !hideSidebar" class="drawer-bg" @click="hideSidebar = true"></div>
<el-aside width="230px" class="sidebar-container" :class="{ 'hide-sidebar': hideSidebar }">
<div class="logo-container">
<router-link to="/">
<img class="sidebar-logo" src="../assets/logo.svg" width="100" alt="logo"/>
<h1 class="sidebar-title">SVS SYSTEM</h1>
</router-link>
</div>
<div class="version">v1.0.0</div>
<SideBar></SideBar>
</el-aside>
<el-main>
<el-button
v-show="isMobile"
class="menu-button"
icon="Fold"
@click="hideSidebar = false"
></el-button>
<keep-alive>
<router-view></router-view>
</keep-alive>
</el-main>
</el-container>
</template>
<script>
import SideBar from './SideBar.vue'
export default {
name: 'LayoutFrame',
components: {
SideBar
},
data() {
return {
isMobile: false,
hideSidebar: true
}
},
mounted() {
window.addEventListener('resize', this.onResize)
this.onResize()
},
beforeUnmount() {
window.removeEventListener('resize', this.onResize)
},
methods: {
onResize() {
this.isMobile = document.body.clientWidth <= 992
}
}
}
</script>
<style>
html {
font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
'\5FAE \8F6F \96C5 \9ED1 ', '微软雅黑', Arial, sans-serif;
}
html,
body,
#app,
.app-wrapper,
.sidebar-container {
height: 100%;
}
body {
margin: 0;
background-color: #f6f8fa;
}
a,
a:focus,
a:hover {
text-decoration: none;
}
.drawer-bg {
background: #000;
opacity: 0.3;
width: 100%;
top: 0;
height: 100%;
position: absolute;
z-index: 999;
}
.sidebar-container {
background-color: #304156;
overflow: hidden;
}
.app-wrapper.mobile .sidebar-container {
position: fixed;
top: 0;
left: 0;
transition-duration: 0.3s;
z-index: 1001;
}
.app-wrapper.mobile .sidebar-container.hide-sidebar {
pointer-events: none;
transition-duration: 0.3s;
transform: translate3d(-230px, 0, 0);
}
.logo-container {
width: 100%;
height: 50px;
line-height: 50px;
background: #2b2f3a;
text-align: center;
}
.sidebar-logo {
width: 32px;
height: 32px;
vertical-align: middle;
margin-right: 12px;
}
.sidebar-title {
display: inline-block;
margin: 0;
color: #fff;
font-weight: 600;
line-height: 50px;
font-size: 14px;
font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
vertical-align: middle;
}
.sidebar-container .version {
height: 30px;
background: #2b2f3a;
color: #aaa;
font-weight: 600;
line-height: 30px;
font-size: 14px;
vertical-align: middle;
text-align: center;
}
.sidebar-container .is-horizontal {
display: none;
}
</style>
|