Browse Source

feat: update

pull/4134/head
tanjinzhou 4 years ago
parent
commit
44ccaa17de
  1. 12
      components/anchor/Anchor.tsx
  2. 10
      components/menu/src/SubMenu.tsx
  3. 5
      components/menu/style/index.less
  4. 2
      v2-doc

12
components/anchor/Anchor.tsx

@ -95,12 +95,6 @@ export default defineComponent({
});
// func...
const getCurrentAnchor = (offsetTop = 0, bounds = 5) => {
const { getCurrentAnchor } = props;
if (typeof getCurrentAnchor === 'function') {
return getCurrentAnchor();
}
const linkSections: Array<Section> = [];
const container = getContainer.value();
state.links.forEach(link => {
@ -127,10 +121,12 @@ export default defineComponent({
return '';
};
const setCurrentActiveLink = (link: string) => {
const { getCurrentAnchor } = props;
if (activeLink.value !== link) {
activeLink.value = link;
emit('change', link);
return;
}
activeLink.value = typeof getCurrentAnchor === 'function' ? getCurrentAnchor() : link;
emit('change', link);
};
const handleScrollTo = (link: string) => {
const { offsetTop, getContainer, targetOffset } = props;

10
components/menu/src/SubMenu.tsx

@ -18,6 +18,7 @@ import PopupTrigger from './PopupTrigger';
import SubMenuList from './SubMenuList';
import InlineSubMenuList from './InlineSubMenuList';
import Transition, { getTransitionProps } from '../../_util/transition';
import { cloneElement } from '../../_util/vnode';
let indexGuid = 0;
@ -177,7 +178,10 @@ export default defineComponent({
);
const renderTitle = (title: any, icon: any) => {
if (!icon) {
return inlineCollapsed.value && props.level === 1 && title && typeof title === 'string' ? (
return inlineCollapsed.value &&
!parentEventKeys.value.length &&
title &&
typeof title === 'string' ? (
<div class={`${prefixCls.value}-inline-collapsed-noicon`}>{title.charAt(0)}</div>
) : (
title
@ -188,7 +192,9 @@ export default defineComponent({
const titleIsSpan = isValidElement(title) && title.type === 'span';
return (
<>
{icon}
{cloneElement(icon, {
class: `${prefixCls.value}-item-icon`,
})}
{titleIsSpan ? title : <span class={`${prefixCls.value}-title-content`}>{title}</span>}
</>
);

5
components/menu/style/index.less

@ -218,6 +218,10 @@
}
}
.@{menu-prefix-cls}-item-icon.svg {
vertical-align: -0.125em;
}
&.@{menu-prefix-cls}-item-only-child {
> .@{iconfont-css-prefix},
> .@{menu-prefix-cls}-item-icon {
@ -530,6 +534,7 @@
text-overflow: clip;
.@{menu-prefix-cls}-submenu-arrow {
opacity: 0;
display: none;
}

2
v2-doc

@ -1 +1 @@
Subproject commit d197053285b81e77718621c0b5b94cb3b21831a2
Subproject commit a7013ae87f69dcbcf547f4b023255b8a7a775557
Loading…
Cancel
Save