Commit 01557420 by liimin

1

1 parent d02b4f5f
......@@ -7,9 +7,11 @@
</template>
<script>
import { currentId } from './mixins/index'
export default {
name: 'LeftSideMenuLv3',
inject: ['bus'],
mixins: [currentId],
props: {
menuItems: {
type: Array,
......@@ -17,7 +19,9 @@ export default {
}
},
methods: {
handleSelect({ path, children = [] }) {
handleSelect({ path, children = [], id }) {
const { lv1, lv2, lv3 } = this.current
if (id == `${lv1}-${lv2}-${lv3}`) return
if (path && path.startsWith('/') && !path.startsWith('/^')) {
this.$router.push(path)
}
......@@ -51,7 +55,7 @@ $menu-item-width: 144px !important;
// padding-left: 0 !important;
padding: 0 8px !important;
span {
@include menu-title-span-haspage
@include menu-title-span-haspage;
}
&.is-active {
@include menu-highlight;
......@@ -60,7 +64,7 @@ $menu-item-width: 144px !important;
}
}
&:hover:not(.is-active) {
@include menu-title-hover;
@include menu-title-hover;
}
}
}
......
......@@ -32,7 +32,6 @@ export default {
},
mounted() {
this.bus.$on('menu3Changed', this.onMenu3Changed)
this.onLoad()
},
beforeDestroy() {
this.bus.$off('menu3Changed', this.onMenu3Changed)
......@@ -42,13 +41,11 @@ export default {
this.$router.push(item.name)
},
setActive(activeId = '', nav4 = []) {
if (this.id == activeId) return
// console.log(this.id , activeId);
this.id = activeId
this.nav4 = nav4
if (nav4.length) {
const sub = nav4.find(({ id }) => id == activeId)
if (sub) {
if (this.activeName == sub.path) return
this.$nextTick(() => {
console.log(sub.path)
this.$router.push(sub.path)
......@@ -66,12 +63,15 @@ export default {
},
onLoad() {
const { lv1, lv2, lv3, lv4 } = this.current
const lv3id = `${lv1}-${lv2}-${lv3}`
const lv4id = `${lv3id}-${lv4}`
console.log(lv4id);
const sub = this.find(lv3id)?.children || []
const nav4 = sub.noHidden()
this.setActive(lv4id, nav4)
if (lv1 && lv2 && lv3 && lv4) {
const lv3id = `${lv1}-${lv2}-${lv3}`
const lv4id = `${lv3id}-${lv4}`
const sub = this.find(lv3id)?.children || []
const nav4 = sub.noHidden()
this.setActive(lv4id, nav4)
} else {
this.setActive('', [])
}
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!