Przeglądaj źródła

[Mod 0000] 看板判别类型的实现方式修改

houzekong 9 miesięcy temu
rodzic
commit
98c1648a77
1 zmienionych plików z 8 dodań i 12 usunięć
  1. 8 12
      src/views/vent/home/billboard/index.vue

+ 8 - 12
src/views/vent/home/billboard/index.vue

@@ -37,7 +37,7 @@
   import BaseCard from './components/BaseCard.vue';
   import ArrowButton from './components/ArrowButton.vue';
   import { BillboardType } from './billboard.data';
-  // import { useRoute } from 'vue-router';
+  import { useRoute } from 'vue-router';
   import { getSummary } from './billboard.api';
   import { useSSO } from '/@/hooks/vent/useSSO';
   import DustStatus from './components/DustStatus.vue';
@@ -47,11 +47,7 @@
   import GasStatus from './components/GasStatus.vue';
   // import mapComponent from './components/3Dmap/index.vue';
 
-  const props = defineProps<{
-    billboardType: string;
-  }>();
-
-  // const route = useRoute();
+  const route = useRoute();
   const { open } = useSSO();
 
   // 组件Map,不同type使用不用组件
@@ -98,20 +94,20 @@
     currentPage.value = Math.max((currentPage.value + pagecount) % totalPage.value, 1);
   }
 
-  // const billboardType = ref('DustStatus');
+  const billboardType = ref('DustStatus');
   // const showBtn = ref(true);
 
   // 页面跳转
   function openHandler(ip: string) {
     const url = `http://${ip}:8092/login`;
-    open(url, routePathMap[props.billboardType]);
+    open(url, routePathMap[billboardType.value]);
   }
 
   onMounted(() => {
-    // if (route.query.type) {
-    //   billboardType.value = route.query.type as string;
-    //   showBtn.value = false;
-    // }
+    if (route.params.type) {
+      billboardType.value = route.params.type as string;
+      // showBtn.value = false;
+    }
     fetchBillboards();
   });
 </script>