8 changed files with 119 additions and 147 deletions
After Width: | Height: | Size: 1.7 KiB |
@ -1,111 +1,122 @@ |
|||||
<template> |
<template> |
||||
<div :class="classObj" class="app-wrapper" :style="{'--current-color': theme}"> |
<div |
||||
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"/> |
:class="classObj" |
||||
<sidebar v-if="!sidebar.hide" class="sidebar-container"/> |
class="app-wrapper" |
||||
<div :class="{hasTagsView:needTagsView,sidebarHide:sidebar.hide}" class="main-container"> |
:style="{ '--current-color': theme }" |
||||
<div :class="{'fixed-header':fixedHeader}"> |
> |
||||
<navbar/> |
<div |
||||
<tags-view v-if="needTagsView"/> |
v-if="device === 'mobile' && sidebar.opened" |
||||
|
class="drawer-bg" |
||||
|
@click="handleClickOutside" |
||||
|
/> |
||||
|
<sidebar v-if="!sidebar.hide" class="sidebar-container" /> |
||||
|
<div |
||||
|
:class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }" |
||||
|
class="main-container" |
||||
|
> |
||||
|
<div :class="{ 'fixed-header': fixedHeader }"> |
||||
|
<navbar /> |
||||
|
<!-- <tags-view v-if="needTagsView"/> --> |
||||
</div> |
</div> |
||||
<app-main/> |
<app-main /> |
||||
<right-panel> |
<right-panel> |
||||
<settings/> |
<settings /> |
||||
</right-panel> |
</right-panel> |
||||
</div> |
</div> |
||||
</div> |
</div> |
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
import RightPanel from '@/components/RightPanel' |
import RightPanel from "@/components/RightPanel"; |
||||
import { AppMain, Navbar, Settings, Sidebar, TagsView } from './components' |
import { AppMain, Navbar, Settings, Sidebar, TagsView } from "./components"; |
||||
import ResizeMixin from './mixin/ResizeHandler' |
import ResizeMixin from "./mixin/ResizeHandler"; |
||||
import { mapState } from 'vuex' |
import { mapState } from "vuex"; |
||||
import variables from '@/assets/styles/variables.scss' |
import variables from "@/assets/styles/variables.scss"; |
||||
|
|
||||
export default { |
export default { |
||||
name: 'Layout', |
name: "Layout", |
||||
components: { |
components: { |
||||
AppMain, |
AppMain, |
||||
Navbar, |
Navbar, |
||||
RightPanel, |
RightPanel, |
||||
Settings, |
Settings, |
||||
Sidebar, |
Sidebar, |
||||
TagsView |
TagsView, |
||||
}, |
}, |
||||
mixins: [ResizeMixin], |
mixins: [ResizeMixin], |
||||
computed: { |
computed: { |
||||
...mapState({ |
...mapState({ |
||||
theme: state => state.settings.theme, |
theme: (state) => state.settings.theme, |
||||
sideTheme: state => state.settings.sideTheme, |
sideTheme: (state) => state.settings.sideTheme, |
||||
sidebar: state => state.app.sidebar, |
sidebar: (state) => state.app.sidebar, |
||||
device: state => state.app.device, |
device: (state) => state.app.device, |
||||
needTagsView: state => state.settings.tagsView, |
needTagsView: (state) => state.settings.tagsView, |
||||
fixedHeader: state => state.settings.fixedHeader |
fixedHeader: (state) => state.settings.fixedHeader, |
||||
}), |
}), |
||||
classObj() { |
classObj() { |
||||
return { |
return { |
||||
hideSidebar: !this.sidebar.opened, |
hideSidebar: !this.sidebar.opened, |
||||
openSidebar: this.sidebar.opened, |
openSidebar: this.sidebar.opened, |
||||
withoutAnimation: this.sidebar.withoutAnimation, |
withoutAnimation: this.sidebar.withoutAnimation, |
||||
mobile: this.device === 'mobile' |
mobile: this.device === "mobile", |
||||
} |
}; |
||||
}, |
}, |
||||
variables() { |
variables() { |
||||
return variables; |
return variables; |
||||
} |
}, |
||||
}, |
}, |
||||
methods: { |
methods: { |
||||
handleClickOutside() { |
handleClickOutside() { |
||||
this.$store.dispatch('app/closeSideBar', { withoutAnimation: false }) |
this.$store.dispatch("app/closeSideBar", { withoutAnimation: false }); |
||||
} |
}, |
||||
} |
}, |
||||
} |
}; |
||||
</script> |
</script> |
||||
|
|
||||
<style lang="scss" scoped> |
<style lang="scss" scoped> |
||||
@import "~@/assets/styles/mixin.scss"; |
@import "~@/assets/styles/mixin.scss"; |
||||
@import "~@/assets/styles/variables.scss"; |
@import "~@/assets/styles/variables.scss"; |
||||
|
|
||||
.app-wrapper { |
.app-wrapper { |
||||
@include clearfix; |
@include clearfix; |
||||
position: relative; |
position: relative; |
||||
height: 100%; |
height: 100%; |
||||
width: 100%; |
width: 100%; |
||||
|
|
||||
&.mobile.openSidebar { |
&.mobile.openSidebar { |
||||
position: fixed; |
|
||||
top: 0; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
.drawer-bg { |
|
||||
background: #000; |
|
||||
opacity: 0.3; |
|
||||
width: 100%; |
|
||||
top: 0; |
|
||||
height: 100%; |
|
||||
position: absolute; |
|
||||
z-index: 999; |
|
||||
} |
|
||||
|
|
||||
.fixed-header { |
|
||||
position: fixed; |
position: fixed; |
||||
top: 0; |
top: 0; |
||||
right: 0; |
|
||||
z-index: 9; |
|
||||
width: calc(100% - #{$base-sidebar-width}); |
|
||||
transition: width 0.28s; |
|
||||
} |
} |
||||
|
} |
||||
|
|
||||
.hideSidebar .fixed-header { |
.drawer-bg { |
||||
width: calc(100% - 54px); |
background: #000; |
||||
} |
opacity: 0.3; |
||||
|
width: 100%; |
||||
|
top: 0; |
||||
|
height: 100%; |
||||
|
position: absolute; |
||||
|
z-index: 999; |
||||
|
} |
||||
|
|
||||
.sidebarHide .fixed-header { |
.fixed-header { |
||||
width: 100%; |
position: fixed; |
||||
} |
top: 0; |
||||
|
right: 0; |
||||
|
z-index: 9; |
||||
|
width: calc(100% - #{$base-sidebar-width}); |
||||
|
transition: width 0.28s; |
||||
|
} |
||||
|
|
||||
.mobile .fixed-header { |
.hideSidebar .fixed-header { |
||||
width: 100%; |
width: calc(100% - 54px); |
||||
} |
} |
||||
|
|
||||
|
.sidebarHide .fixed-header { |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
.mobile .fixed-header { |
||||
|
width: 100%; |
||||
|
} |
||||
</style> |
</style> |
||||
|
Loading…
Reference in new issue