-
-
Notifications
You must be signed in to change notification settings - Fork 5k
This PR addresses issue #831, adding public Router#resolve method #877
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
Conversation
Thanks for the pr! |
const fullPath = resolved.redirectedFrom || resolved.fullPath | ||
const base = router.history.base | ||
const href = createHref(base, fullPath, router.mode) | ||
const { normalizedTo, resolved, href } = this.$router._resolve(this.to, current, this.append) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can directly call router._resolve
Me too. We can rename that internal method, I think. |
I like this PR. @hogart, Can you solve the conflicts? |
Thanks, @LinusBorg. I merged my branch with upstream. |
@hogart sorry to bother again. This also needs a a unnit test for the new #resolve() function. Could you add one? |
Sorry I forgot this... I agree with @posva that we should use a single resolve method, both internally and as public api. Let's wait for Evan's input on this. |
@LinusBorg I'd like to, but I didn't found place for testing Router class. @fnlctrl, @posva how do you imagine it? We need several pieces of info in |
@hogart By one method I meant that I'd rather have |
@posva I understand what you want, but, sorry, I don't see how we can use |
@hogart Oh, I wanted to say that resolve would return the whole object not just an |
@posva that's definitely possible:) But in my opinion this pollutes API surface, are you guys sure about that? |
no, I personally think it's ok. Why does it pollutes the api surface, is it because you may never use the rest of the returned object? |
@posva yes, because of that. |
* 🐛 Remove extra old params in named routes * ✅ Add tests
I'm closing this PR because messed-up changelog, see #918 instead. |
Along with necessary typings and docs.
From technical perspective this change adds protected
_resolve
and publicresolve
methods, latter being wrapper around first._resolve
is used in<router-link/>
, since it requires a lot of additional info.resolve
just returns relevant bits from that.Function
createHref
was moved tosrc/index.js
, but maybe belongs insc/util/path.js
.