If I use this url www.myapp/test/ I see an output in the console, but if I’m using www.myapp/test/PARAM the console is empty… but the content of the page is displayed
this is the folder structure
-| test/
---| index.vue
Is this the proper way to get params from dynamic urls and if yes what I’m doing wrong?
Hey there,
If I’m understanding correctly, the param won’t be available at the time you’re trying to access it because of your redirect rule. That rule is processed before we return the page to the browser, so any param you enter will have been parsed out by the time you are checking the console.log. The timing of this is:
Our servers check the redirect rule associated with that path. The rule says “if someone requests myapp.com/test/*, send them to this path instead: myapp.com/test/”
Our servers return myapp.com/test/ to the browser; your browser updates accordingly.
So if you want to retain the param, I’d suggest incorporating query params into your redirect rules:
Let us know if that helps or if you have other questions!