feat: update
parent
de4693c321
commit
44ccaa17de
|
@ -95,12 +95,6 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
// func...
|
// func...
|
||||||
const getCurrentAnchor = (offsetTop = 0, bounds = 5) => {
|
const getCurrentAnchor = (offsetTop = 0, bounds = 5) => {
|
||||||
const { getCurrentAnchor } = props;
|
|
||||||
|
|
||||||
if (typeof getCurrentAnchor === 'function') {
|
|
||||||
return getCurrentAnchor();
|
|
||||||
}
|
|
||||||
|
|
||||||
const linkSections: Array<Section> = [];
|
const linkSections: Array<Section> = [];
|
||||||
const container = getContainer.value();
|
const container = getContainer.value();
|
||||||
state.links.forEach(link => {
|
state.links.forEach(link => {
|
||||||
|
@ -127,10 +121,12 @@ export default defineComponent({
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
const setCurrentActiveLink = (link: string) => {
|
const setCurrentActiveLink = (link: string) => {
|
||||||
|
const { getCurrentAnchor } = props;
|
||||||
if (activeLink.value !== link) {
|
if (activeLink.value !== link) {
|
||||||
activeLink.value = link;
|
return;
|
||||||
emit('change', link);
|
|
||||||
}
|
}
|
||||||
|
activeLink.value = typeof getCurrentAnchor === 'function' ? getCurrentAnchor() : link;
|
||||||
|
emit('change', link);
|
||||||
};
|
};
|
||||||
const handleScrollTo = (link: string) => {
|
const handleScrollTo = (link: string) => {
|
||||||
const { offsetTop, getContainer, targetOffset } = props;
|
const { offsetTop, getContainer, targetOffset } = props;
|
||||||
|
|
|
@ -18,6 +18,7 @@ import PopupTrigger from './PopupTrigger';
|
||||||
import SubMenuList from './SubMenuList';
|
import SubMenuList from './SubMenuList';
|
||||||
import InlineSubMenuList from './InlineSubMenuList';
|
import InlineSubMenuList from './InlineSubMenuList';
|
||||||
import Transition, { getTransitionProps } from '../../_util/transition';
|
import Transition, { getTransitionProps } from '../../_util/transition';
|
||||||
|
import { cloneElement } from '../../_util/vnode';
|
||||||
|
|
||||||
let indexGuid = 0;
|
let indexGuid = 0;
|
||||||
|
|
||||||
|
@ -177,7 +178,10 @@ export default defineComponent({
|
||||||
);
|
);
|
||||||
const renderTitle = (title: any, icon: any) => {
|
const renderTitle = (title: any, icon: any) => {
|
||||||
if (!icon) {
|
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>
|
<div class={`${prefixCls.value}-inline-collapsed-noicon`}>{title.charAt(0)}</div>
|
||||||
) : (
|
) : (
|
||||||
title
|
title
|
||||||
|
@ -188,7 +192,9 @@ export default defineComponent({
|
||||||
const titleIsSpan = isValidElement(title) && title.type === 'span';
|
const titleIsSpan = isValidElement(title) && title.type === 'span';
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{icon}
|
{cloneElement(icon, {
|
||||||
|
class: `${prefixCls.value}-item-icon`,
|
||||||
|
})}
|
||||||
{titleIsSpan ? title : <span class={`${prefixCls.value}-title-content`}>{title}</span>}
|
{titleIsSpan ? title : <span class={`${prefixCls.value}-title-content`}>{title}</span>}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
@ -218,6 +218,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.@{menu-prefix-cls}-item-icon.svg {
|
||||||
|
vertical-align: -0.125em;
|
||||||
|
}
|
||||||
|
|
||||||
&.@{menu-prefix-cls}-item-only-child {
|
&.@{menu-prefix-cls}-item-only-child {
|
||||||
> .@{iconfont-css-prefix},
|
> .@{iconfont-css-prefix},
|
||||||
> .@{menu-prefix-cls}-item-icon {
|
> .@{menu-prefix-cls}-item-icon {
|
||||||
|
@ -530,6 +534,7 @@
|
||||||
text-overflow: clip;
|
text-overflow: clip;
|
||||||
|
|
||||||
.@{menu-prefix-cls}-submenu-arrow {
|
.@{menu-prefix-cls}-submenu-arrow {
|
||||||
|
opacity: 0;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
v2-doc
2
v2-doc
|
@ -1 +1 @@
|
||||||
Subproject commit d197053285b81e77718621c0b5b94cb3b21831a2
|
Subproject commit a7013ae87f69dcbcf547f4b023255b8a7a775557
|
Loading…
Reference in New Issue