瀏覽代碼

[Feat 0000] 为看板添加路由决定类型的逻辑

houzekong 10 月之前
父節點
當前提交
56495b70d1
共有 1 個文件被更改,包括 13 次插入2 次删除
  1. 13 2
      src/views/vent/home/billboard/index.vue

+ 13 - 2
src/views/vent/home/billboard/index.vue

@@ -11,7 +11,7 @@
         </BaseCard>
       </a-col>
     </a-row>
-    <div style="position: absolute; top: 0; left: 0">
+    <div v-if="showBtn" style="position: absolute; top: 0; left: 0">
       <a-button @click="billboardType = 'dust'">切换粉尘看板</a-button>
       <a-button @click="billboardType = 'fire'">切换火灾看板</a-button>
       <a-button @click="billboardType = 'file'">切换文件看板</a-button>
@@ -23,12 +23,15 @@
   </div>
 </template>
 <script lang="ts" setup>
-  import { computed, ref } from 'vue';
+  import { computed, onMounted, ref } from 'vue';
   import BaseCard from './components/BaseCard.vue';
   import ArrowButton from './components/ArrowButton.vue';
   import { BILLBOARDS, COMPONENTS_MAP } from './billboard.data';
+  import { useRoute } from 'vue-router';
   // import mapComponent from './components/3Dmap/index.vue';
 
+  const route = useRoute();
+
   const mainTitle = computed(() => '国家能源神东煤炭集团');
 
   // 一页最多支持几个看板项
@@ -46,6 +49,14 @@
   }
 
   const billboardType = ref('dust');
+  const showBtn = ref(true);
+
+  onMounted(() => {
+    if (route.query.type) {
+      billboardType.value = route.query.type as string;
+      showBtn.value = false;
+    }
+  });
 </script>
 <style lang="less" scoped>
   @font-face {