Commit a21e798b8f321c6c6c107541b795879d20c22b75
1 parent
acba45fe
udpate
Showing
3 changed files
with
4 additions
and
7 deletions
Show diff stats
src/components/menu/menu-item.vue
src/components/menu/mixin.js
1 | -import { findComponentsUpward } from '../../utils/assist'; | |
1 | +import { hasParentSubmenu, findComponentUpward, findComponentsUpward } from '../../utils/assist'; | |
2 | 2 | export default { |
3 | 3 | computed: { |
4 | + hasParentSubmenu () { | |
5 | + return findComponentUpward(this, 'Submenu'); | |
6 | + }, | |
4 | 7 | parentSubmenuNum () { |
5 | 8 | return findComponentsUpward(this, 'Submenu').length; |
6 | 9 | } | ... | ... |
src/components/menu/submenu.vue
... | ... | @@ -75,9 +75,6 @@ |
75 | 75 | if (this.dropWidth) style.minWidth = `${this.dropWidth}px`; |
76 | 76 | return style; |
77 | 77 | }, |
78 | - hasParentSubmenu () { | |
79 | - return findComponentUpward(this, 'Submenu'); | |
80 | - }, | |
81 | 78 | titleStyle () { |
82 | 79 | return this.hasParentSubmenu ? { |
83 | 80 | paddingLeft: 43 + (this.parentSubmenuNum - 1) * 24 + 'px' | ... | ... |