mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 20:09:08 +08:00
commit
39d38c03d5
@ -66,7 +66,15 @@ export class AsideNav extends React.Component<AsideNavProps, AsideNavState> {
|
|||||||
<ul className={cx('AsideNav-subList')}>
|
<ul className={cx('AsideNav-subList')}>
|
||||||
{link.label ? (
|
{link.label ? (
|
||||||
<li key="subHeader" className={cx('AsideNav-subHeader')}>
|
<li key="subHeader" className={cx('AsideNav-subHeader')}>
|
||||||
<a>{link.label}</a>
|
{renderLink(
|
||||||
|
{
|
||||||
|
...link,
|
||||||
|
children: undefined
|
||||||
|
},
|
||||||
|
'subHeader',
|
||||||
|
{},
|
||||||
|
depth
|
||||||
|
)}
|
||||||
</li>
|
</li>
|
||||||
) : null}
|
) : null}
|
||||||
{link.children.map((link, key) =>
|
{link.children.map((link, key) =>
|
||||||
@ -183,6 +191,7 @@ export class AsideNav extends React.Component<AsideNavProps, AsideNavState> {
|
|||||||
toggleExpand: this.toggleExpand,
|
toggleExpand: this.toggleExpand,
|
||||||
depth,
|
depth,
|
||||||
classnames: cx,
|
classnames: cx,
|
||||||
|
subHeader: key === 'subHeader',
|
||||||
...others
|
...others
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -256,20 +256,17 @@ export default class App extends React.Component<AppProps, object> {
|
|||||||
{asideBefore ? render('aside-before', asideBefore) : null}
|
{asideBefore ? render('aside-before', asideBefore) : null}
|
||||||
<AsideNav
|
<AsideNav
|
||||||
navigations={store.navigations}
|
navigations={store.navigations}
|
||||||
renderLink={({
|
renderLink={(
|
||||||
link,
|
{link, active, toggleExpand, classnames: cx, depth, subHeader}: any,
|
||||||
active,
|
key: any
|
||||||
toggleExpand,
|
) => {
|
||||||
classnames: cx,
|
|
||||||
depth
|
|
||||||
}: any) => {
|
|
||||||
let children = [];
|
let children = [];
|
||||||
|
|
||||||
if (link.visible === false) {
|
if (link.visible === false) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (link.children && link.children.length) {
|
if (!subHeader && link.children && link.children.length) {
|
||||||
children.push(
|
children.push(
|
||||||
<span
|
<span
|
||||||
key="expand-toggle"
|
key="expand-toggle"
|
||||||
@ -292,11 +289,11 @@ export default class App extends React.Component<AppProps, object> {
|
|||||||
</b>
|
</b>
|
||||||
);
|
);
|
||||||
|
|
||||||
if (link.icon) {
|
if (!subHeader && link.icon) {
|
||||||
children.push(
|
children.push(
|
||||||
<i key="icon" className={cx(`AsideNav-itemIcon`, link.icon)} />
|
<i key="icon" className={cx(`AsideNav-itemIcon`, link.icon)} />
|
||||||
);
|
);
|
||||||
} else if (store.folded && depth === 1) {
|
} else if (store.folded && depth === 1 && !subHeader) {
|
||||||
children.push(
|
children.push(
|
||||||
<i
|
<i
|
||||||
key="icon"
|
key="icon"
|
||||||
|
Loading…
Reference in New Issue
Block a user