餐饮油烟智能监测与监管一体化平台
feiyu02
6 天以前 ccc970e575ef3f3e5c67af8da210263f4ac549f9
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
<template>
  <el-container class="base-container">
    <el-header ref="headerRef" class="base-header">
      <slot name="header"></slot>
    </el-header>
    <el-container>
      <el-aside class="base-aside" :style="{ height: mainHeight + 'px', width: asideWidth }">
        <el-scrollbar :noresize="false">
          <slot name="aside"></slot>
        </el-scrollbar>
      </el-aside>
      <el-main class="base-main" :style="{ height: mainHeight + 'px' }">
        <el-scrollbar :noresize="false">
          <div style="padding: 0 8px 0 8px">
            <slot name="main"></slot>
          </div>
        </el-scrollbar>
      </el-main>
    </el-container>
  </el-container>
</template>
 
<script>
export default {
  inject: ['contentMaxHeight', 'headerHeight'],
  props: {
    asideWidth: {
      type: String,
      default: '300px',
    },
  },
  // 右侧操作界面基础布局
  data() {
    return {
      mainHeight: this.contentMaxHeight,
    }
  },
  methods: {
    // 内容高度
    calHeight() {
      if (this.$refs.headerRef) {
        const h1 = this.$refs.headerRef.$el.offsetHeight
        const h = h1
        return this.contentMaxHeight - h
        // return `calc(100vh - ${h}px - 60px - var(--el-main-padding) * 2 + 6px)`;
      } else {
        return this.contentMaxHeight
      }
    },
  },
  mounted() {
    setTimeout(() => {
      this.mainHeight = this.calHeight()
    }, 200)
  },
}
</script>
 
<style scoped lang="scss">
.base-container {
  // height: calc(100vh - 60px);
  // background-color: aliceblue;
  position: relative;
}
.base-aside {
  /* width: initial; */
  /* overflow-x: auto; */
  position: relative;
  // height: calc(100vh - 60px * 2 - 20px * 2);
  /* background-color: aqua; */
  /* overflow-y: auto; */
  border-right: 1px solid var(--el-color-info-light-7);
  /* box-shadow: -10px 0px 4px rgba(0, 0, 0, 0.12) inset; */
}
 
.base-header {
  height: initial;
  // padding: 0 0 4px 0;
  /* background-color: rgb(216, 201, 201); */
  /* border-bottom: 1px solid var(--el-color-info-light-7); */
  /* margin-bottom: 4px; */
}
 
.base-main {
  position: relative;
  padding: 0;
  /* background-color: whitesmoke; */
  /* height: calc(100vh - 60px * 2 - 20px * 2); */
  /* overflow: hidden; */
}
</style>