diff --git a/src/store/index.js b/src/store/index.js index ceffa8e..a82f3e1 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,17 +1,12 @@ -import Vue from 'vue' -import Vuex from 'vuex' +import Vue from "vue"; +import Vuex from "vuex"; -Vue.use(Vuex) +Vue.use(Vuex); export default new Vuex.Store({ - state: { - }, - getters: { - }, - mutations: { - }, - actions: { - }, - modules: { - } -}) + state: {}, + getters: {}, + mutations: {}, + actions: {}, + modules: {}, +}); diff --git a/src/views/lll/NYJCD.vue b/src/views/lll/NYJCD.vue index 705523e..a832213 100644 --- a/src/views/lll/NYJCD.vue +++ b/src/views/lll/NYJCD.vue @@ -57,7 +57,7 @@ -
+
@@ -106,7 +106,7 @@
-
+
@@ -158,7 +158,7 @@ export default { res: "月", click1: "", click2: "", - flag: true, + flag: false, option1: { xAxis: { type: "category", @@ -339,7 +339,6 @@ export default { goOne(a) { this.click2 = ""; this.click1 = a; - this.flag = false; if (this.click1 == "配电室") { this.$router.replace( "/area/nyjcd/pds", @@ -357,7 +356,6 @@ export default { goTwo(a) { this.click1 = ""; this.click2 = a; - this.flag = false; this.$router.replace( `/area/nyjcd/scx1?type=${this.click2}`, () => {}, @@ -621,8 +619,20 @@ export default { this.defineEcharts("yrfd", option); }, }, - created() { - this.flag = true; + created() {}, + watch: { + // 监听,当路由发生变化的时候执行 + $route: { + handler(to, from) { + if (to.path == "/area/nyjcd") { + this.flag = true; + } else { + this.flag = false; + } + }, + deep: true, // 深度观察监听 + immediate: true, // 第一次初始化渲染就可以监听到 + }, }, mounted() { this.defineEcharts("qcssdh", this.option1);