add style for menu-group
This commit is contained in:
parent
5edd66a8c6
commit
3e3fba0ec2
2 changed files with 25 additions and 1 deletions
|
@ -30,6 +30,16 @@
|
|||
</template>
|
||||
<Menu-item name="3-3-3-1">四级1</Menu-item>
|
||||
<Menu-item name="3-3-3-2">四级2</Menu-item>
|
||||
<MenuGroup title="Menu-Group">
|
||||
<MenuItem name="3-3-3-3-1">
|
||||
<Icon type="document-text"></Icon>
|
||||
Group-item1
|
||||
</MenuItem>
|
||||
<MenuItem name="3-3-3-3-2">
|
||||
<Icon type="chatbubbles"></Icon>
|
||||
Group-item2
|
||||
</MenuItem>
|
||||
</MenuGroup>
|
||||
</Submenu>
|
||||
</Submenu>
|
||||
</Submenu>
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<template>
|
||||
<li :class="[prefixCls + '-item-group']">
|
||||
<div :class="[prefixCls + '-item-group-title']">{{ title }}</div>
|
||||
<div :class="[prefixCls + '-item-group-title']" :style="groupStyle">{{ title }}</div>
|
||||
<ul><slot></slot></ul>
|
||||
</li>
|
||||
</template>
|
||||
<script>
|
||||
import { findComponentUpward, findComponentsUpward } from '../../utils/assist';
|
||||
const prefixCls = 'ivu-menu';
|
||||
|
||||
export default {
|
||||
|
@ -19,6 +20,19 @@
|
|||
return {
|
||||
prefixCls: prefixCls
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
parentSubmenuNum () {
|
||||
return findComponentsUpward(this, 'Submenu').length;
|
||||
},
|
||||
hasParentSubmenu () {
|
||||
return findComponentUpward(this, 'Submenu');
|
||||
},
|
||||
groupStyle () {
|
||||
return this.hasParentSubmenu ? {
|
||||
paddingLeft: 43 + (this.parentSubmenuNum - 1) * 28 + 'px'
|
||||
} : {};
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Add table
Reference in a new issue