feiyu02
2025-09-17 b330e57051e54789eb83d10dc58c4d9d10c608e1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<template>
  <el-menu
    default-active="scene"
    ellipsis
    mode="horizontal"
    style="max-width: 600px"
  >
    <el-menu-item
      v-for="item in menu"
      :key="item.path"
      :index="item.path"
      @click="navPage"
      >{{ item.name }}</el-menu-item
    >
  </el-menu>
  <router-view v-slot="{ Component, route }">
    <keep-alive>
      <component
        v-if="route.meta.keepAlive"
        :is="Component"
        :key="route.name"
      />
    </keep-alive>
    <component v-if="!route.meta.keepAlive" :is="Component" :key="route.name" />
  </router-view>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { useRouter, useRoute } from 'vue-router';
 
const router = useRouter();
const route = useRoute();
 
const menu = ref([
  {
    name: '场景清单',
    path: 'scene',
    selected: true
  },
  {
    name: '评估清单',
    path: 'evaluate'
  },
  {
    name: '巡查信息',
    path: 'inspection'
  },
  {
    name: '监测数据',
    path: 'monitorData'
  }
]);
 
const navPage = (item) => {
  if (item.index) {
    router.push({
      path: item.index
    });
  }
};
</script>
<style scoped></style>