Explorar o código

没有能耗数据 则隐藏第三屏

zhaojijng %!s(int64=2) %!d(string=hai) anos
pai
achega
56fdc2352b
Modificáronse 3 ficheiros con 4 adicións e 3 borrados
  1. 2 2
      src/App.vue
  2. 1 0
      src/components/LastAllEnergy.vue
  3. 1 1
      src/router/index.ts

+ 2 - 2
src/App.vue

@@ -6,9 +6,9 @@ export default defineComponent({
     setup() {
         const projectStore = useProjectStore();
         onMounted(() => {
-             projectStore.setLastAllEnergy();
+            
              
-            //这两个请求不能写在这里 router.beforeEach 发生在后面,其中有 改变projectId的方法
+            //这两个请求不能写在这里  因为router.beforeEach 发生在后面,获取不到projectId
             // projectStore.setWeather();
             // projectStore.setProjectObj();
         });

+ 1 - 0
src/components/LastAllEnergy.vue

@@ -58,6 +58,7 @@ export default defineComponent({
             widthBase: "0%",
             compareBase: "0%",
         });
+        //因为用到 所以执行
         const lastAllComputed = computed(() => {
             const lastAllEnergy = projectStore.lastAllEnergy;
             //debugger;

+ 1 - 1
src/router/index.ts

@@ -43,7 +43,7 @@ router.beforeEach(async (to, from, next) => {
 
     await projectStore.setWeather();
     await projectStore.setProjectObj();
-
+    await projectStore.setLastAllEnergy();
     next();
     // if (to.path.indexOf("login") == -1) {
     //     return { name: "login" };