2019-07-02 16:29:52 +08:00
|
|
|
<template>
|
2019-08-09 15:10:13 +08:00
|
|
|
<div class="app-wrapper" :class="classObj">
|
|
|
|
<div class="main-container">
|
|
|
|
<navbar />
|
2019-09-02 15:37:57 +08:00
|
|
|
<app-main :style="{width: width+'px', height: height+'px'}" />
|
2019-07-02 16:29:52 +08:00
|
|
|
</div>
|
2019-08-09 15:10:13 +08:00
|
|
|
</div>
|
2019-07-02 16:29:52 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-08-09 15:10:13 +08:00
|
|
|
import { Navbar, AppMain } from './components'; // Sidebar
|
2019-07-02 16:29:52 +08:00
|
|
|
|
2019-08-09 15:10:13 +08:00
|
|
|
export default {
|
|
|
|
name: 'Layout',
|
|
|
|
components: {
|
|
|
|
Navbar,
|
|
|
|
AppMain
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
sidebar() {
|
|
|
|
return this.$store.state.app.sidebar;
|
|
|
|
},
|
|
|
|
device() {
|
|
|
|
return this.$store.state.app.device;
|
|
|
|
},
|
|
|
|
classObj() {
|
|
|
|
return {
|
|
|
|
withoutAnimation: this.sidebar.withoutAnimation,
|
|
|
|
mobile: this.device === 'mobile'
|
|
|
|
};
|
2019-09-02 15:37:57 +08:00
|
|
|
},
|
|
|
|
width() {
|
|
|
|
return this.$store.state.app.width;
|
|
|
|
},
|
|
|
|
height() {
|
|
|
|
return this.$store.state.app.height - 60;
|
2019-08-09 15:10:13 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.watchRouterUpdate();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleClickOutside() {
|
|
|
|
this.$store.dispatch('CloseSideBar', { withoutAnimation: false });
|
|
|
|
},
|
|
|
|
watchRouterUpdate() {
|
|
|
|
this.$router.beforeEach((to, from, next) => {
|
|
|
|
next();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2019-07-02 16:29:52 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
@import "src/styles/mixin.scss";
|
|
|
|
|
|
|
|
.app-wrapper {
|
|
|
|
@include clearfix;
|
|
|
|
position: relative;
|
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
.drawer-bg {
|
|
|
|
background: #000;
|
|
|
|
opacity: 0.3;
|
|
|
|
width: 100%;
|
|
|
|
left: 0;
|
|
|
|
top: 0;
|
|
|
|
height: 100%;
|
|
|
|
position: absolute;
|
|
|
|
z-index: 999;
|
|
|
|
}
|
2019-08-09 15:10:13 +08:00
|
|
|
</style>
|