schangxiang@126.com
2024-04-23 f47411fb53aeee0c7bd514cbc841f9030349f448
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
<template>
  <div class="home-index-page" ref="page" :style="{height:pageHeight}">
    <div class="block-left">
      <div class="block-left-top"><module-a /></div>
      <div class="block-left-bottom"><module-b /></div>
    </div>
    <div class="block-right"><module-c /></div>
  </div>
</template>
 
<script>
import ModuleA from './ModuleA.vue'
import ModuleB from './ModuleB.vue'
import ModuleC from './ModuleC.vue'
export default {
  name:'homeIndexPage',
  components:{ModuleA,ModuleB,ModuleC},
  data(){
    return {
      pageHeight:'100%'
    }
  },
  watch:{
    '$store.state.app.multiTab':{
      deep:true,
      handler:(newVal,oldVal)=>{
        this.calPageHeight(newVal)
      }
    }
  },
  methods:{
    calPageHeight(hasTab){
      if (hasTab) {
       let _h = this.$refs.page.clientHeight;
       if (_h) {
         this.pageHeight = (_h-42)+'px'
       }
      } else {
        this.pageHeight = '100%';
      }
    },
    initPageHeight(callback){
      setTimeout(()=>{
        this.calPageHeight(this.$store.state.app.multiTab)
        callback && callback()
      },100)
    }
  },
  mounted(){
    this.initPageHeight()
  }
}
</script>
 
<style lang="less" scoped>
.home-index-page{
  overflow: hidden;
  display: flex;
  min-width: 1000px;
  .block-right{
    width:30%;
    min-width:300px;
    flex-shrink: 0;
  }
  .block-left{
    flex-grow: 1;
    box-sizing: border-box;
    padding-right: 24px;
    display: flex;
    flex-direction: column;
    .block-left-top{
      flex-shrink: 0;
    }
    .block-left-bottom{
      flex-grow: 1;
    }
  }
}
</style>