wr1207
2023-04-17 32e4bad2cff2793052effcd2d59cdd8923702b22
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
<template>
  <el-container :class="classObj" id="aside">
    <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"/>
    <Side class="sidebar-container" />
    <el-container class="main-container">
      <el-header v-if="!dialog_url" class="header-container">
        <Head/>
      </el-header>
      <el-main id="main" :style="{backgroundColor:main_background_color}">
        <TagView v-if="showtags && !dialog_url"/>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>
<script>
import { mapState } from 'vuex'
import Head from './Head'
import Side from './Side'
import TagView from './TagView'
import ResizeMixin from './ResizeHandle'
export default {
  name:'Main',
  components: { Head,Side,TagView},
  computed: {
    ...mapState({
      device: state => state.app.device,
      sidebar: state => state.app.sidebar,
      showtags: state => state.setting.tagsView,
    }),
    classObj() {
      return {
        mobile: this.device === 'mobile',
        hideSidebar: !this.sidebar.opened,
        openSidebar: this.sidebar.opened,
        withoutAnimation: this.sidebar.withoutAnimation,
      }
    },
  },
  data(){
    return{
      main_background_color:'#F2F6FC',
      dialog_url:this.$route.query.dialogstate,
    }
  },
  mixins: [ResizeMixin],
  methods: {
    handleClickOutside() {
      this.$store.dispatch('closeSideBar', { withoutAnimation: false })
    }
  },
};
</script>
<style scoped>
.el-header{padding: 0 0 0 20px;}
.drawer-bg {
    background: #000;
    opacity: 0.3;
    width: 100%;
    top: 0;
    height: 100%;
    position: absolute;
    z-index: 999;
  }
#aside {
  height: 100vh;
}
#main {
  height: 100vh;
  overflow: auto;
}
/*滚动条的宽度*/
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
 
/*外层轨道。可以用display:none让其不显示,也可以添加背景图片,颜色改变显示效果*/
::-webkit-scrollbar-track {
  width: 6px;
  background-color: #f2f6fc;
  -webkit-border-radius: 2em;
  -moz-border-radius: 2em;
  border-radius: 2em;
}
 
/*滚动条的设置*/
 
::-webkit-scrollbar-thumb {
  background-color: #999;
  background-clip: padding-box;
  min-height: 1px;
  -webkit-border-radius: 2em;
  -moz-border-radius: 2em;
  border-radius: 2em;
}
/*滚动条移上去的背景*/
 
::-webkit-scrollbar-thumb:hover {
  background-color: #fff;
}
 
 
.el-main{padding: 15px 15px 15px 15px}
</style>