| | |
| | | <template> |
| | | <div class="page-mode"> |
| | | <div @mouseenter="item.childrenFlag = true" :class="{ active: currentUrl.indexOf(item.path) != -1 }" |
| | | <div @mouseenter="item.childrenFlag = true" :class="{ active: buttonIndex == item.value }" |
| | | @mouseleave="item.childrenFlag = false" @click="goToPath(item)" v-for="(item, index) in menuList" :key="index"> |
| | | {{ item.menuName }} |
| | | </div> |
| | |
| | | import { useRouter, useRoute } from 'vue-router' |
| | | import { Search } from '@element-plus/icons-vue' |
| | | import { getTime } from '@/utils/getTime.js' |
| | | import { usePointStore } from 'store/usepoint' |
| | | const useAppStore = usePointStore() |
| | | let router = useRouter() |
| | | let currentUrl = ref('statistics') |
| | | |
| | | const menuList = ref( |
| | | [ |
| | | { |
| | | menuName: '雨水管网', |
| | | path: '/layout/ys' |
| | | menuName: '企业信息', |
| | | value: 1, |
| | | }, |
| | | { |
| | | menuName: '污水管网', |
| | | path: '/layout/ws' |
| | | menuName: '应急物资', |
| | | value: 2, |
| | | }, |
| | | { |
| | | menuName: '三级防控', |
| | | path: '/layout/sj' |
| | | menuName: '应急空间', |
| | | value: 3, |
| | | }, |
| | | { |
| | | menuName: '三道防线', |
| | | value: 4, |
| | | } |
| | | ] |
| | | ) |
| | | let { buttonIndex } = defineProps({ |
| | | buttonIndex: Number |
| | | }) |
| | | |
| | | // 父级方法 |
| | | const emit = defineEmits(['childEvent']) |
| | | |
| | | const goToPath = (params) => { |
| | | if (params.children && params.children.length > 0) return |
| | | |
| | | if (params.path) { |
| | | if (router.currentRoute.value.path == params.path) return |
| | | // router.push(params.path) |
| | | } else { |
| | | params.childrenFlag = !params.childrenFlag |
| | | if (params.value == 1) { |
| | | emit('childEvent', params.value) |
| | | return |
| | | } else if (params.value == 2) { |
| | | emit('childEvent', params.value) |
| | | return |
| | | } else if (params.value == 3) { |
| | | emit('childEvent', params.value) |
| | | return |
| | | } else if (params.value == 4) { |
| | | emit('childEvent', params.value) |
| | | return |
| | | } |
| | | } |
| | | |