Commit 0c253308 by liimin

优化

1 parent 449e3220
...@@ -10,10 +10,11 @@ ...@@ -10,10 +10,11 @@
<script> <script>
import { currentId } from './mixins/index' import { currentId } from './mixins/index'
import { mapGetters } from 'vuex'
export default { export default {
name: 'LeftSideMenuLv2', name: 'LeftSideMenuLv2',
mixins: [currentId], mixins: [currentId],
inject: ['bus'], inject: ['bus', 'isPop'],
created() { created() {
this.bus.$on('menuOpenedsChanged', this.handleMenuOpenedsChanged) this.bus.$on('menuOpenedsChanged', this.handleMenuOpenedsChanged)
}, },
...@@ -23,6 +24,9 @@ export default { ...@@ -23,6 +24,9 @@ export default {
beforeDestroy() { beforeDestroy() {
this.bus.$off('menuOpenedsChanged', this.handleMenuOpenedsChanged) this.bus.$off('menuOpenedsChanged', this.handleMenuOpenedsChanged)
}, },
computed: {
...mapGetters(['menu'])
},
watch: { watch: {
current: { current: {
handler(n) { handler(n) {
...@@ -43,6 +47,7 @@ export default { ...@@ -43,6 +47,7 @@ export default {
this.cur.active = `${lv1}-${lv2}-${lv3}` this.cur.active = `${lv1}-${lv2}-${lv3}`
}, },
handleMenuOpenedsChanged({ menus }) { handleMenuOpenedsChanged({ menus }) {
if (this.menu.isCollapse && !this.isPop) return
const _ids = menus.map(({ id, children = [] }) => { const _ids = menus.map(({ id, children = [] }) => {
if (children.noHidden().length) { if (children.noHidden().length) {
return id return id
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!