context.d.ts 698 B

123456789101112131415161718
  1. import type { Ref, InjectionKey, ComputedRef } from 'vue';
  2. import type { AnchorDirection } from './Anchor';
  3. export interface AnchorContext {
  4. registerLink: (link: string) => void;
  5. unregisterLink: (link: string) => void;
  6. activeLink: Ref<string>;
  7. scrollTo: (link: string) => void;
  8. handleClick: (e: Event, info: {
  9. title: any;
  10. href: string;
  11. }) => void;
  12. direction: ComputedRef<AnchorDirection>;
  13. }
  14. export declare const AnchorContextKey: InjectionKey<AnchorContext>;
  15. declare const useProvideAnchor: (state: AnchorContext) => void;
  16. declare const useInjectAnchor: () => AnchorContext;
  17. export { useInjectAnchor, useProvideAnchor };
  18. export default useProvideAnchor;