feat: anchor add activeLink arg
parent
ebc2082934
commit
1d08e80165
|
@ -57,7 +57,7 @@ export const anchorProps = () => ({
|
||||||
getContainer: Function as PropType<() => AnchorContainer>,
|
getContainer: Function as PropType<() => AnchorContainer>,
|
||||||
wrapperClass: String,
|
wrapperClass: String,
|
||||||
wrapperStyle: { type: Object as PropType<CSSProperties>, default: undefined as CSSProperties },
|
wrapperStyle: { type: Object as PropType<CSSProperties>, default: undefined as CSSProperties },
|
||||||
getCurrentAnchor: Function as PropType<() => string>,
|
getCurrentAnchor: Function as PropType<(activeLink: string) => string>,
|
||||||
targetOffset: Number,
|
targetOffset: Number,
|
||||||
onChange: Function as PropType<(currentActiveLink: string) => void>,
|
onChange: Function as PropType<(currentActiveLink: string) => void>,
|
||||||
onClick: Function as PropType<(e: MouseEvent, link: { title: any; href: 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) {
|
if (activeLink.value === link) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
activeLink.value = typeof getCurrentAnchor === 'function' ? getCurrentAnchor() : link;
|
activeLink.value = typeof getCurrentAnchor === 'function' ? getCurrentAnchor(link) : link;
|
||||||
emit('change', link);
|
emit('change', link);
|
||||||
};
|
};
|
||||||
const handleScrollTo = (link: string) => {
|
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 | |
|
| affix | Fixed mode of Anchor | boolean | true | |
|
||||||
| bounds | Bounding distance of anchor area | number | 5(px) | |
|
| bounds | Bounding distance of anchor area | number | 5(px) | |
|
||||||
| getContainer | Scrolling container | () => HTMLElement | () => window | |
|
| 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 | - | |
|
| 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 | |
|
| offsetTop | Pixels to offset from top when calculating position of scroll | number | 0 | |
|
||||||
| showInkInFixed | Whether show ink-balls when `:affix="false"` | boolean | false | |
|
| 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 | |
|
| affix | 固定模式 | boolean | true | |
|
||||||
| bounds | 锚点区域边界 | number | 5(px) | |
|
| bounds | 锚点区域边界 | number | 5(px) | |
|
||||||
| getContainer | 指定滚动的容器 | () => HTMLElement | () => window | |
|
| getContainer | 指定滚动的容器 | () => HTMLElement | () => window | |
|
||||||
| getCurrentAnchor | 自定义高亮的锚点 | () => string | - | 1.5.0 |
|
| getCurrentAnchor | 自定义高亮的锚点 | (activeLink: string) => string | - | activeLink(3.3) |
|
||||||
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | number | | |
|
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | number | | |
|
||||||
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | | |
|
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | | |
|
||||||
| showInkInFixed | `:affix="false"` 时是否显示小圆点 | boolean | false | |
|
| showInkInFixed | `:affix="false"` 时是否显示小圆点 | boolean | false | |
|
||||||
|
|
Loading…
Reference in New Issue