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
$router.params
set to false when accessing route directly
#3
Comments
@docweirdo Thanks for the heads up, I've updated it to an empty object. |
Is it not possible to have the parameters even when that route was accessed directly? |
Here's how the
I'm not sure if what you want is the
|
No, my trouble is the following. I define something like <template x-route="/hello/:user">
Hello <span x-text="$router.params.user"></span>
</template> But when I go to |
Probably because the template in <template x-route="/hello/:user">
<div>Hello <span x-text="$router.params.user"></span></div>
</template> and make sure you set the |
I am facing exactly the same issue. I am using Vite and async-alpine, which could be the problem. I've used your code plus I double-checked the directive in the body index.html <body x-data x-init="$router.config({ mode: 'hash' })">
<div id="app" class="login">
<div ax-load ax-load-src="js/components/Home/home.js" x-data="home()" x-html="view" x-ignore></div>
</div>
<script type="module" src="/main.js"></script>
</body> home.js component <div ax-load ax-load-src="js/components/ChildModule/main.js" x-data="ChildModule()" x-html="view" x-ignore></div>
<a x-link href="/hello/world">Hello World</a>
<template x-route="/hello/:user">
<div>Hello <span x-text="$router.params.user"></span></div> <!-- @IMPORTANT: @BUG When I refresh the params are missing and it shows just "Hello" -->
</template> |
Sorry for the delay. It took me some time to get around to testing this again. Accessing the path |
@docweirdo Please try replacing the URL from @jgauna Are you experiencing the same situation? |
I forgot to mention that I, for this screenshot, had changed it to the default rooting mode, sorry. In fact, when changing it back to The issue does persist in the recommended HTML5 mode. |
Fixed, please check the latest version. Thank you @docweirdo @jgauna |
Wonderful, thank you very much, the example works now with |
Copying the example from README.md, the value of
$router.params
is set tofalse
when accessing the route/hello/world
directly without using the link provided byx-link
.The text was updated successfully, but these errors were encountered: