|
1
2
|
<template>
<div :class="classObj" class="app-wrapper">
|
|
3
4
5
6
7
|
<div
v-if="device === 'mobile' && sidebar.opened"
class="drawer-bg"
@click="handleClickOutside"
/>
|
|
8
9
|
<sidebar class="sidebar-container" />
<div class="main-container">
|
|
10
|
<div :class="{ 'fixed-header': fixedHeader }">
|
|
11
|
<navbar />
|
|
12
|
<tags-view />
|
|
13
14
|
</div>
<app-main />
|
|
15
16
17
|
<div :class="{ 'fixed-footer': fixedFooter }">
<copyright />
</div>
|
|
18
19
20
21
22
|
</div>
</div>
</template>
<script>
|
|
23
24
25
26
|
import { AppMain, Navbar, Sidebar, TagsView, Copyright } from "./components";
import ResizeMixin from "./mixin/ResizeHandler";
import { getDictDetails } from "@/api/common";
import Vue from "vue";
|
|
27
28
|
export default {
|
|
29
|
name: "Layout",
|
|
30
31
32
|
components: {
Navbar,
Sidebar,
|
|
33
|
AppMain,
|
|
34
|
TagsView,
|
|
35
|
Copyright,
|
|
36
37
38
39
|
},
mixins: [ResizeMixin],
computed: {
sidebar() {
|
|
40
|
return this.$store.state.app.sidebar;
|
|
41
42
|
},
device() {
|
|
43
|
return this.$store.state.app.device;
|
|
44
45
|
},
fixedHeader() {
|
|
46
|
return this.$store.state.settings.fixedHeader;
|
|
47
|
},
|
|
48
|
fixedFooter() {
|
|
49
|
return this.$store.state.settings.fixedFooter;
|
|
50
|
},
|
|
51
52
53
54
55
|
classObj() {
return {
hideSidebar: !this.sidebar.opened,
openSidebar: this.sidebar.opened,
withoutAnimation: this.sidebar.withoutAnimation,
|
|
56
57
58
|
mobile: this.device === "mobile",
};
},
|
|
59
|
},
|
|
60
61
62
63
64
|
created() {
getDictDetails({ code: "AlarmCodes" }).then((res) => {
Vue.prototype.$dict = res.data;
});
},
|
|
65
|
mounted() {},
|
|
66
67
|
methods: {
handleClickOutside() {
|
|
68
69
70
71
|
this.$store.dispatch("app/closeSideBar", { withoutAnimation: false });
},
},
};
|
|
72
73
74
|
</script>
<style lang="scss" scoped>
|
|
75
76
|
@import "~@/styles/mixin.scss";
@import "~@/styles/variables.scss";
|
|
77
|
|
|
78
79
80
81
82
83
|
.app-wrapper {
@include clearfix;
position: relative;
height: 100%;
width: 100%;
&.mobile.openSidebar {
|
|
84
85
86
|
position: fixed;
top: 0;
}
|
|
87
|
// overflow: scroll;
|
|
88
89
90
91
92
93
94
95
96
97
|
}
.drawer-bg {
background: #000;
opacity: 0.3;
width: 100%;
top: 0;
height: 100%;
position: absolute;
z-index: 999;
}
|
|
98
|
|
|
99
100
101
102
103
104
105
106
|
.fixed-header {
position: fixed;
top: 0;
right: 0;
z-index: 9;
width: calc(100% - #{$sideBarWidth});
transition: width 0.28s;
}
|
|
107
|
|
|
108
109
110
111
112
113
114
|
.hideSidebar .fixed-header {
width: calc(100% - 54px);
}
.mobile .fixed-header {
width: 100%;
}
|
|
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
.fixed-footer {
position: fixed;
bottom: 0;
right: 0;
z-index: 1000;
width: calc(100% - #{$sideBarWidth});
transition: width 0.28s;
}
.hideSidebar .fixed-footer {
width: calc(100% - 54px);
}
.mobile .fixed-footer {
width: 100%;
}
|
|
132
|
</style>
|