mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-02 03:58:05 +08:00
feat: anchor add activeLink arg
This commit is contained in:
parent
ebc2082934
commit
1d08e80165
@ -57,7 +57,7 @@ export const anchorProps = () => ({
|
||||
getContainer: Function as PropType<() => AnchorContainer>,
|
||||
wrapperClass: String,
|
||||
wrapperStyle: { type: Object as PropType<CSSProperties>, 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) => {
|
||||
|
@ -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 | |
|
||||
|
@ -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 | |
|
||||
|
Loading…
Reference in New Issue
Block a user