]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
feat(link): expose useLink on RouterLink as internal (#1002)
authorKael <kaelwd@gmail.com>
Fri, 18 Jun 2021 10:15:08 +0000 (20:15 +1000)
committerGitHub <noreply@github.com>
Fri, 18 Jun 2021 10:15:08 +0000 (12:15 +0200)
Co-authored-by: Eduardo San Martin Morote <posva13@gmail.com>
src/RouterLink.ts

index dbee6205bcf3985f6d5cc6cdfa68f1a2df80d076..0dbef7140729a06172ceb95425d417e78343aac4 100644 (file)
@@ -149,6 +149,8 @@ export const RouterLinkImpl = /*#__PURE__*/ defineComponent({
     },
   },
 
+  useLink,
+
   setup(props, { slots }) {
     const link = reactive(useLink(props))
     const { options } = inject(routerKey)!
@@ -218,13 +220,20 @@ export const RouterLinkImpl = /*#__PURE__*/ defineComponent({
 /**
  * Component to render a link that triggers a navigation on click.
  */
-export const RouterLink = RouterLinkImpl as {
+export const RouterLink = RouterLinkImpl as unknown as {
   new (): {
     $props: AllowedComponentProps &
       ComponentCustomProps &
       VNodeProps &
       RouterLinkProps
   }
+
+  /**
+   * Access to `useLink()` without depending on using vue-router
+   *
+   * @internal
+   */
+  useLink: typeof useLink
 }
 
 function guardEvent(e: MouseEvent) {