前端页面点击abnormal alarm标签页面跳转到了spectrum analysis标签页面
This commit is contained in:
parent
4121038a6a
commit
30d6f111d3
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="custom-top-menu">
|
||||
<a-menu mode="horizontal" v-model="selectedKeys" @click="onMenuSelect">
|
||||
<a-menu-item v-for="(menu, index) in menus" :key="menu.name" :class="{ 'is-last': index === menus.length - 1}">
|
||||
<a-menu-item v-for="(menu, index) in menus" :key="menu.name" :class="{ 'is-last': index === menus.length - 1 }">
|
||||
<img
|
||||
v-show="menu.name === selectedKeys[0]"
|
||||
class="menu-logo"
|
||||
|
@ -15,7 +15,7 @@
|
|||
alt=""
|
||||
/>
|
||||
<span v-html="menu.meta.title.split(' ').join('<br>')"></span>
|
||||
<img v-if="index !== menus.length - 1" class="split-line" src="@/assets/images/header/split-line.png" alt="">
|
||||
<img v-if="index !== menus.length - 1" class="split-line" src="@/assets/images/header/split-line.png" alt="" />
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</div>
|
||||
|
@ -26,12 +26,12 @@ export default {
|
|||
props: {
|
||||
menus: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
selectedKeys: []
|
||||
selectedKeys: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -40,15 +40,15 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
onMenuSelect({ key }) {
|
||||
const childPath = this.getChildrenPath(this.menuItems.find(menu => menu.name === key))
|
||||
if (key == "abnormal-alarm" ) {
|
||||
const childPath = this.getChildrenPath(this.menuItems.find((menu) => menu.name === key))
|
||||
if (key == 'abnormal-alarm') {
|
||||
const selectedKeys = window.sessionStorage.getItem('currMenu_alarm')
|
||||
if (selectedKeys) {
|
||||
this.$router.push(selectedKeys)
|
||||
} else {
|
||||
this.$router.push(childPath)
|
||||
}
|
||||
} else if (key == "istatistics") {
|
||||
} else if (key == 'istatistics') {
|
||||
const selectedKeys = window.sessionStorage.getItem('currMenu_web')
|
||||
if (selectedKeys) {
|
||||
this.$router.push(selectedKeys)
|
||||
|
@ -82,19 +82,19 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
$route(route) {
|
||||
const currTopMenu = this.findTopMenuByRouteName(this.menuItems, route.name)
|
||||
this.selectedKeys = [currTopMenu.name]
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
menuItems() {
|
||||
return this.menus.filter(item => !item.hidden)
|
||||
}
|
||||
}
|
||||
return this.menus.filter((item) => !item.hidden)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -130,10 +130,12 @@ export default {
|
|||
watch: {
|
||||
$route: {
|
||||
handler: function (val, oldVal) {
|
||||
this.currSlecteKey = []
|
||||
console.log(val)
|
||||
this.currSlecteKey.push(val.path)
|
||||
window.sessionStorage.setItem('currMenu_alarm', val.path)
|
||||
if (val.name === 'abnormal-alarm') {
|
||||
this.currSlecteKey = []
|
||||
this.currSlecteKey.push(val.path)
|
||||
window.sessionStorage.setItem('currMenu_alarm', val.path)
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
immediate: true,
|
||||
|
|
Loading…
Reference in New Issue
Block a user