Skip to content

this.$route.query and fullPath not working in abstract mode #2959

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

Closed
fayt81 opened this issue Oct 8, 2019 · 2 comments
Closed

this.$route.query and fullPath not working in abstract mode #2959

fayt81 opened this issue Oct 8, 2019 · 2 comments

Comments

@fayt81
Copy link

fayt81 commented Oct 8, 2019

Version

3.0.2

Reproduction link

https://codesandbox.io/embed/vue-template-0vm7k

Steps to reproduce

With vue-router set in abstract mode, when the main App is created, call console.log(this.$route.query) and console.log(this.$route.fullPath), either before or after router.replace('/').

What is expected?

this.$route.query should be an object with the GET values
this.$route.fullPath should display the full route path in the URL

What is actually happening?

regardless of what you write in the URL
this.$route.query is an empty object
this.$route.fullPath is always '/'


If you set vue-router in history mode, this.$route.query and fullPath provide the expected value (of course before router.replace('/')).

@posva
Copy link
Member

posva commented Oct 8, 2019

In abstract mode, when you start the router you are in a nowhere place. It's meant to work in any environment like node without a URL, so it doesn't take into account the current window.location like other histories do

@posva posva closed this as completed Oct 8, 2019
@fayt81
Copy link
Author

fayt81 commented Oct 8, 2019

Hi @posva, this seams in contrast with what @yyx990803 and @Samuell1 wrote in #729. They said that the router starts in a nowhere place, but also that you should manually call router.replace to give a change of rendering a non-route URL. If you cannot read the URL, how can you render a non-route URL? And how can you pass any URL parameter, path, or whatever in the abstract mode? I think that the abstract mode should be able to read query and fullPath BEFORE you call router.replace, so that you will have the chance to manually force a non-route node with replace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants