I want to store my url when I am on the main page /main
in the browser before going to another page using nuxt-link
. This is my nuxt-link
:
<NuxtLink
:to="`/search?param={number}`"
@click.native="assignAddress"
>
SEARCH
</NuxtLink>
And this is the method that is triggered by clicking on nuxt-link
:
assignAddress() {
localStorage.setItem("address", `${this.$route.path}`);
},
The issue is that it saves /search
in the browser. What I think happens is that the method assignAddress
is being triggered after nuxt changes the page!
How can I store the url in the browser first and then change the page so in my browser I store /main
instead of /search
?