Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(link): expose useLink on RouterLink as internal #1002

Merged
merged 2 commits into from Jun 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/RouterLink.ts
Expand Up @@ -149,6 +149,8 @@ export const RouterLinkImpl = /*#__PURE__*/ defineComponent({
},
},

useLink,

setup(props, { slots }) {
const link = reactive(useLink(props))
const { options } = inject(routerKey)!
Expand Down Expand Up @@ -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) {
Expand Down