Skip to content

Commit 4fcf59e

Browse files
committed
docs: note about toRef
1 parent ceeb7c2 commit 4fcf59e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

docs/guide/advanced/extending-router-link.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ Let's extend RouterLink to handle external links as well and adding a custom `in
99
<a v-if="isExternalLink" v-bind="$attrs" :href="to" target="_blank">
1010
<slot />
1111
</a>
12-
<router-link v-else v-bind="$props" custom v-slot="{ isActive, href, navigate }">
12+
<router-link
13+
v-else
14+
v-bind="$props"
15+
custom
16+
v-slot="{ isActive, href, navigate }"
17+
>
1318
<a
1419
v-bind="$attrs"
1520
:href="href"
@@ -57,6 +62,8 @@ export default {
5762
},
5863

5964
setup(props) {
65+
// toRef allows us to extract one prop and keep it reactive
66+
// https://v3.vuejs.org/api/refs-api.html#toref
6067
const { navigate, href route, isActive, isExactActive } = useLink(toRef(props, 'to'))
6168

6269

0 commit comments

Comments
 (0)