2023西安数博会CIM演示-【前端】-Web
AdaKing88
2023-08-21 bc03b832caa49bbcd2674fe4cae3701b5059bf95
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
<!--
 * @Description: 总体布局
 * @Author: 王旭
 * @Date: 2022-03-01 15:33:01
 * @LastEditTime: 2022-03-22 14:25:53
 * @LastEditors: 王旭
-->
<template>
  <div class="home">
    <!-- elementui布局 -->
    <el-container>
      <!-- <el-header style="padding: 0; height: 60px"> -->
        <!-- 头部导航里 -->
        <!-- <headerV></headerV>
      </el-header> -->
      <el-container style="margin: 0px; padding: 0px; height: 100%">
        <el-main :style="styleVar">
          <!--为第3级别业务组件的显示设置占位符-->
          <keep-alive>
            <router-view />
          </keep-alive>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>
 
<script>
import { mapMutations } from "vuex";
import headerV from "../components/headers.vue";
// import navMenu from "../components/navMenu.vue";
export default {
  name: "Home",
  data() {
    return {
      currentPath: "",
      styleVar: {
        "--background": "transparent",
      },
    };
  },
  components: {
    headerV,
  },
  watch: {
    // 监听,当路由发生变化的时候执行
    $route(to, from) {
      this.UPstyle(to.path);
    },
  },
  methods: {
    ...mapMutations(["INITIAL_DATA_MENU"]),
    //修改样式
    UPstyle(e) {
      if (e == "/firstpage") {
        this.styleVar["--background"] = "#000";
      } else {
        this.styleVar["--background"] = "transparent";
      }
    },
    //初始化界面读取数据菜单配置,并保存到state中
    InitalDataMenuType() {
      let that = this;
      this.$axios({
        methods: "get",
        url: "/datamenutypes/get",
        data: null,
      }).then((res) => {
        console.log(res);
        if (res.data.status === 200) that.INITIAL_DATA_MENU(res.data.rows);
      });
    },
  },
  created() {
    this.UPstyle(this.$route.path);
    //this.InitalDataMenuType();
  },
};
</script>
<style scoped lang="less">
.home {
  height: 100%;
  position: relative;
 
  .el-container {
    height: 100%;
  }
}
 
.el-main {
  margin: 0px;
  padding: 0px;
  background: var(--background);
}
</style>