Commit 6b4e738352a5ea9a6fdea178f49d228bacd4c838
1 parent
b4c37946
update menu-group
Showing
1 changed file
with
2 additions
and
6 deletions
Show diff stats
src/components/menu/menu-group.vue
| @@ -6,10 +6,12 @@ | @@ -6,10 +6,12 @@ | ||
| 6 | </template> | 6 | </template> |
| 7 | <script> | 7 | <script> |
| 8 | import { findComponentUpward, findComponentsUpward } from '../../utils/assist'; | 8 | import { findComponentUpward, findComponentsUpward } from '../../utils/assist'; |
| 9 | + import mixin from './mixin'; | ||
| 9 | const prefixCls = 'ivu-menu'; | 10 | const prefixCls = 'ivu-menu'; |
| 10 | 11 | ||
| 11 | export default { | 12 | export default { |
| 12 | name: 'MenuGroup', | 13 | name: 'MenuGroup', |
| 14 | + mixins: [ mixin ], | ||
| 13 | props: { | 15 | props: { |
| 14 | title: { | 16 | title: { |
| 15 | type: String, | 17 | type: String, |
| @@ -22,12 +24,6 @@ | @@ -22,12 +24,6 @@ | ||
| 22 | }; | 24 | }; |
| 23 | }, | 25 | }, |
| 24 | computed: { | 26 | computed: { |
| 25 | - parentSubmenuNum () { | ||
| 26 | - return findComponentsUpward(this, 'Submenu').length; | ||
| 27 | - }, | ||
| 28 | - hasParentSubmenu () { | ||
| 29 | - return findComponentUpward(this, 'Submenu'); | ||
| 30 | - }, | ||
| 31 | groupStyle () { | 27 | groupStyle () { |
| 32 | return this.hasParentSubmenu ? { | 28 | return this.hasParentSubmenu ? { |
| 33 | paddingLeft: 43 + (this.parentSubmenuNum - 1) * 28 + 'px' | 29 | paddingLeft: 43 + (this.parentSubmenuNum - 1) * 28 + 'px' |