-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Vue.js router-link issue #143
Comments
@depsimon Hello! Is this issue taken? to see if I could work on it |
Hi all! any news on this? |
Hey! Thank you for your bug report! When I load the sandbox I get an error, is it possible to fix it so that I can take a look? In the meantime, Internally we us a |
Hmm maybe the Sandbox is fixed now? I had trouble opening it again, but now it seems okay. |
Hey, I was able to get around this by using router-link slots:
It doesn't seem to work if RouterLink is a child to MenuItem. This might be because RouterLink does not have |
I fixed a sort of related issue earlier (#249), so that we can get access to the underlying DOM node, even when using a custom component. But it seems like the router-link doesn't forward all the props correctly (aka the onClick prop). Here is a codesandbox: https://codesandbox.io/s/headlessuivue-menu-example-forked-31t3b?file=/src/components/Menu.vue |
My work around is to define a component called <template>
<span
@click="
typeof $attrs?.href === 'string' && $router.push({ path: $attrs.href })
"
><a><slot /></a
></span>
</template> |
This was the only way I could get this to work, using Vue 3.3.4, Vue Router 4.2.4, and Headless UI 1.7.16: <RouterLink v-slot="{ href, navigate }" :to="{ name: 'admin' }" custom>
<MenuItem v-slot="{ close }">
<a :href="href" @click.prevent="navigate();close()">Administration</a>
</MenuItem>
</RouterLink> |
It seems like
<router-link />
(vue-router-next) doesn't work the same inside a<MenuItem />
as it does outside of it.Here's a little demo: https://codesandbox.io/s/headlessuivue-menu-example-forked-xiitu
When navigating between Home & About pages from the Menu, the page refreshes completely.
When navigating with the top links it doesn't, as it should be.
Any idea what's happening?
The text was updated successfully, but these errors were encountered: