<template>
|
<div id="app" class="el-science-blue" :class="getClass">
|
<router-view ref="routerView"></router-view>
|
</div>
|
</template>
|
|
<script>
|
let link;
|
export default {
|
name: "App",
|
data() {
|
return {
|
fullScreen: false,
|
};
|
},
|
watch: {
|
"$store.state.ukey.connect"(isConnet) {
|
this.$store.dispatch("ukey/checkIsIn", isConnet);
|
},
|
"$store.state.ukey.isIn"(isIn) {
|
this.$store.dispatch("ukey/changeId", isIn);
|
},
|
"$store.state.theme.activeSkin"(val) {
|
if (val == "science-blue") {
|
link.href = "./theme/science-blue.css";
|
} else if (val == "science-green") {
|
link.href = "./theme/science-green.css";
|
} else if (val == "science-black") {
|
link.href = "./theme/science-black.css";
|
}
|
let iframes = this.$refs.routerView.$el.getElementsByTagName("iframe");
|
for (let i = 0; i < iframes.length; i++) {
|
iframes[i].contentDocument.getElementById("theme").href = link.href;
|
}
|
},
|
},
|
mounted() {
|
// 启动ukey监控
|
this.$store.dispatch("ukey/load", true);
|
require("./assets/css/m-elementui.css");
|
this.appenCss();
|
require("./assets/css/basic.css");
|
require("./assets/css/common.css");
|
},
|
methods: {
|
appenCss() {
|
link = document.createElement("link");
|
link.type = "text/css";
|
link.id = "theme";
|
link.rel = "stylesheet";
|
if (this.$store.state.theme.activeSkin == "science-blue") {
|
link.href = "./theme/science-blue.css";
|
} else if (this.$store.state.theme.activeSkin == "science-green") {
|
link.href = "./theme/science-green.css";
|
} else if (this.$store.state.theme.activeSkin == "science-black") {
|
link.href = "./theme/science-black.css";
|
}
|
document.getElementsByTagName("head")[0].appendChild(link);
|
},
|
},
|
computed: {
|
getClass() {
|
return {
|
"no-bg": this.$route.path == "/home" ? false : true,
|
};
|
},
|
},
|
};
|
</script>
|
|
<style>
|
#app {
|
box-sizing: border-box;
|
height: 100vh;
|
}
|
#app.no-bg {
|
background-image: none;
|
}
|
</style>
|