Commit dc1058ae by liimin

1

1 parent 2db68526
<template> <template>
<div class="scrm-base-mebu-lv4" v-show="nav4 && nav4.length"> <div class="scrm-base-mebu-lv4" v-show="nav4 && nav4.length">
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName">
<el-tab-pane :name="item.path" v-for="item in nav4" :key="item.id"> <el-tab-pane :name="item.path" v-for="item in nav4" :key="item.id">
<span slot="label" style="padding: 0 10px">{{ item.title }}</span> <span slot="label" style="padding: 0 10px">{{ item.title }}</span>
</el-tab-pane> </el-tab-pane>
...@@ -22,12 +22,17 @@ export default { ...@@ -22,12 +22,17 @@ export default {
} }
}, },
watch: { watch: {
// current: { current: {
// handler() { handler() {
// this.onLoad() this.onLoad()
// }, },
// immediate: true immediate: true
// } },
activeName: {
handler(n) {
n?.startsWith('/') && this.$router.push(n)
}
}
}, },
mounted() { mounted() {
this.bus.$on('menu3Changed', this.onMenu3Changed) this.bus.$on('menu3Changed', this.onMenu3Changed)
...@@ -37,18 +42,12 @@ export default { ...@@ -37,18 +42,12 @@ export default {
this.bus.$off('menu3Changed', this.onMenu3Changed) this.bus.$off('menu3Changed', this.onMenu3Changed)
}, },
methods: { methods: {
handleClick(item) {
this.$router.push(item.name)
},
setActive(activeId = '', nav4 = []) { setActive(activeId = '', nav4 = []) {
this.nav4 = nav4 this.nav4 = nav4
if (nav4.length) { if (nav4.length) {
const sub = nav4.find(({ id }) => id == activeId) const sub = nav4.find(({ id }) => id == activeId)
if (sub) { if (sub) {
this.$nextTick(() => { this.$nextTick(() => (this.activeName = sub.path))
this.activeName = sub.path
this.$router.push(sub.path)
})
} }
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!