Merge pull request #1428 from 2betop/appnav

收起状态导航菜单不可点击跳转问题修复
This commit is contained in:
RickCole 2021-01-22 17:19:59 +08:00 committed by GitHub
commit 39d38c03d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 11 deletions

View File

@ -66,7 +66,15 @@ export class AsideNav extends React.Component<AsideNavProps, AsideNavState> {
<ul className={cx('AsideNav-subList')}>
{link.label ? (
<li key="subHeader" className={cx('AsideNav-subHeader')}>
<a>{link.label}</a>
{renderLink(
{
...link,
children: undefined
},
'subHeader',
{},
depth
)}
</li>
) : null}
{link.children.map((link, key) =>
@ -183,6 +191,7 @@ export class AsideNav extends React.Component<AsideNavProps, AsideNavState> {
toggleExpand: this.toggleExpand,
depth,
classnames: cx,
subHeader: key === 'subHeader',
...others
});

View File

@ -256,20 +256,17 @@ export default class App extends React.Component<AppProps, object> {
{asideBefore ? render('aside-before', asideBefore) : null}
<AsideNav
navigations={store.navigations}
renderLink={({
link,
active,
toggleExpand,
classnames: cx,
depth
}: any) => {
renderLink={(
{link, active, toggleExpand, classnames: cx, depth, subHeader}: any,
key: any
) => {
let children = [];
if (link.visible === false) {
return null;
}
if (link.children && link.children.length) {
if (!subHeader && link.children && link.children.length) {
children.push(
<span
key="expand-toggle"
@ -292,11 +289,11 @@ export default class App extends React.Component<AppProps, object> {
</b>
);
if (link.icon) {
if (!subHeader && link.icon) {
children.push(
<i key="icon" className={cx(`AsideNav-itemIcon`, link.icon)} />
);
} else if (store.folded && depth === 1) {
} else if (store.folded && depth === 1 && !subHeader) {
children.push(
<i
key="icon"