diff --git a/components/anchor/Anchor.tsx b/components/anchor/Anchor.tsx index 9fd6ac319..50503ada0 100644 --- a/components/anchor/Anchor.tsx +++ b/components/anchor/Anchor.tsx @@ -57,7 +57,7 @@ export const anchorProps = () => ({ getContainer: Function as PropType<() => AnchorContainer>, wrapperClass: String, wrapperStyle: { type: Object as PropType, default: undefined as CSSProperties }, - getCurrentAnchor: Function as PropType<() => string>, + getCurrentAnchor: Function as PropType<(activeLink: string) => string>, targetOffset: Number, onChange: Function as PropType<(currentActiveLink: string) => void>, onClick: Function as PropType<(e: MouseEvent, link: { title: any; href: string }) => void>, @@ -123,7 +123,7 @@ export default defineComponent({ if (activeLink.value === link) { return; } - activeLink.value = typeof getCurrentAnchor === 'function' ? getCurrentAnchor() : link; + activeLink.value = typeof getCurrentAnchor === 'function' ? getCurrentAnchor(link) : link; emit('change', link); }; const handleScrollTo = (link: string) => { diff --git a/components/anchor/index.en-US.md b/components/anchor/index.en-US.md index 2bb20a28e..bbe7aa61d 100644 --- a/components/anchor/index.en-US.md +++ b/components/anchor/index.en-US.md @@ -21,7 +21,7 @@ For displaying anchor hyperlinks on page and jumping between them. | affix | Fixed mode of Anchor | boolean | true | | | bounds | Bounding distance of anchor area | number | 5(px) | | | getContainer | Scrolling container | () => HTMLElement | () => window | | -| getCurrentAnchor | Customize the anchor highlight | () => string | - | 1.5.0 | +| getCurrentAnchor | Customize the anchor highlight | (activeLink: string) => string | - | activeLink(3.3) | | offsetBottom | Pixels to offset from bottom when calculating position of scroll | number | - | | | offsetTop | Pixels to offset from top when calculating position of scroll | number | 0 | | | showInkInFixed | Whether show ink-balls when `:affix="false"` | boolean | false | | diff --git a/components/anchor/index.zh-CN.md b/components/anchor/index.zh-CN.md index 309dc9faf..097e4fd9f 100644 --- a/components/anchor/index.zh-CN.md +++ b/components/anchor/index.zh-CN.md @@ -22,7 +22,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/_1-C1JwsC/Anchor.svg | affix | 固定模式 | boolean | true | | | bounds | 锚点区域边界 | number | 5(px) | | | getContainer | 指定滚动的容器 | () => HTMLElement | () => window | | -| getCurrentAnchor | 自定义高亮的锚点 | () => string | - | 1.5.0 | +| getCurrentAnchor | 自定义高亮的锚点 | (activeLink: string) => string | - | activeLink(3.3) | | offsetBottom | 距离窗口底部达到指定偏移量后触发 | number | | | | offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | | | | showInkInFixed | `:affix="false"` 时是否显示小圆点 | boolean | false | |