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.

122 lines
2.9 KiB

<template>
<div :class="classObj" class="app-wrapper" :style="{'--current-color': theme}">
4 months ago
<!-- 头部区域独占一行 -->
<div class="header-container">
<navbar/> <!-- 导航栏组件 -->
</div>
<!-- 主内容区域 -->
<div class="main-container">
<!-- 侧边栏仅在侧边栏未隐藏时显示 -->
<sidebar v-if="!sidebar.hide" class="sidebar-container"/>
<!-- 右侧内容区域 -->
<div :class="{'content-container': true, 'sidebarHide': sidebar.hide}">
<tags-view v-if="needTagsView"/> <!-- 标签视图组件仅在 needTagsView 为真时显示 -->
<app-main/> <!-- 主要内容区域 -->
</div>
</div>
4 months ago
<!-- 右侧面板包含设置面板 -->
<right-panel>
<settings/> <!-- 设置面板组件 -->
</right-panel>
</div>
</template>
<script>
import RightPanel from '@/components/RightPanel'
import { AppMain, Navbar, Settings, Sidebar, TagsView } from './components'
import ResizeMixin from './mixin/ResizeHandler'
import { mapState } from 'vuex'
import variables from '@/assets/styles/variables.scss'
export default {
name: 'Layout',
components: {
AppMain,
Navbar,
RightPanel,
Settings,
Sidebar,
TagsView
},
mixins: [ResizeMixin],
computed: {
...mapState({
theme: state => state.settings.theme,
sideTheme: state => state.settings.sideTheme,
sidebar: state => state.app.sidebar,
needTagsView: state => state.settings.tagsView,
fixedHeader: state => state.settings.fixedHeader
}),
classObj() {
return {
hideSidebar: !this.sidebar.opened,
openSidebar: this.sidebar.opened,
4 months ago
withoutAnimation: this.sidebar.withoutAnimation
}
},
variables() {
return variables;
}
},
methods: {
handleClickOutside() {
this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
}
}
}
</script>
<style lang="scss" scoped>
@import "~@/assets/styles/mixin.scss";
@import "~@/assets/styles/variables.scss";
.app-wrapper {
@include clearfix;
position: relative;
height: 100%;
width: 100%;
4 months ago
display: flex;
flex-direction: column;
background-image: url("../../src/assets/images/bg@2x.png");
background-size: 100% 100%;
}
4 months ago
.header-container {
width: 100%;
4 months ago
height: $base-header-height;
background-color: #fff;
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
z-index: 1000;
}
4 months ago
.main-container {
display: flex;
flex: 1;
overflow: hidden;
background-color: #fff;
}
4 months ago
.sidebar-container {
width: $base-sidebar-width;
height: 100%;
transition: width 0.28s;
margin-top: 60px;
background-color: #f0f2f5;
}
4 months ago
.content-container {
flex: 1;
height: 100%;
overflow: auto;
padding: 16px;
background-color: #f0f2f5;
transition: margin-left 0.28s;
4 months ago
&.sidebarHide {
margin-left: 0;
}
}
4 months ago
</style>