diff --git a/src/components/menu/menu-item.vue b/src/components/menu/menu-item.vue index d4fdce9..074192b 100644 --- a/src/components/menu/menu-item.vue +++ b/src/components/menu/menu-item.vue @@ -40,9 +40,6 @@ return this.hasParentSubmenu ? { paddingLeft: 43 + (this.parentSubmenuNum - 1) * 24 + 'px' } : {}; - }, - hasParentSubmenu () { - return findComponentUpward(this, 'Submenu'); } }, methods: { diff --git a/src/components/menu/mixin.js b/src/components/menu/mixin.js index d6374bf..3d49761 100644 --- a/src/components/menu/mixin.js +++ b/src/components/menu/mixin.js @@ -1,6 +1,9 @@ -import { findComponentsUpward } from '../../utils/assist'; +import { hasParentSubmenu, findComponentUpward, findComponentsUpward } from '../../utils/assist'; export default { computed: { + hasParentSubmenu () { + return findComponentUpward(this, 'Submenu'); + }, parentSubmenuNum () { return findComponentsUpward(this, 'Submenu').length; } diff --git a/src/components/menu/submenu.vue b/src/components/menu/submenu.vue index cd4255e..d010450 100644 --- a/src/components/menu/submenu.vue +++ b/src/components/menu/submenu.vue @@ -75,9 +75,6 @@ if (this.dropWidth) style.minWidth = `${this.dropWidth}px`; return style; }, - hasParentSubmenu () { - return findComponentUpward(this, 'Submenu'); - }, titleStyle () { return this.hasParentSubmenu ? { paddingLeft: 43 + (this.parentSubmenuNum - 1) * 24 + 'px' -- libgit2 0.21.4