3.0.1
http://jsfiddle.net/df4Lnuw6/698/
No warning to be shown.
A warning is shown saying that the id param was not provided. The docs mention that the current route will be used if omitted.
In current implementation, this is how the resolve method is implemented https://github.com/vuejs/vue-router/blob/dev/src/index.js#L177 :
resolve (
to: RawLocation,
current?: Route,
append?: boolean
): {
location: Location,
route: Route,
href: string,
// for backwards compat
normalizedTo: Location,
resolved: Route
} {
const location = normalizeLocation(
to,
current || this.history.current,
append,
this
)
const route = this.match(location, current)
const fullPath = route.redirectedFrom || route.fullPath
const base = this.history.base
const href = createHref(base, fullPath, this.mode)
return {
location,
route,
href,
// for backwards compat
normalizedTo: location,
resolved: route
}
}
I am thinking the issue is coming from from line 195:
const route = this.match(location, current)
I am proposing this new implementation:
resolve (
to: RawLocation,
current?: Route,
append?: boolean
): {
location: Location,
route: Route,
href: string,
// for backwards compat
normalizedTo: Location,
resolved: Route
} {
current = current || this.history.current
const location = normalizeLocation(
to,
current,
append,
this
)
const route = this.match(location, current)
const fullPath = route.redirectedFrom || route.fullPath
const base = this.history.base
const href = createHref(base, fullPath, this.mode)
return {
location,
route,
href,
// for backwards compat
normalizedTo: location,
resolved: route
}
}
Will love to receive feedbacks..
yeah, I remember I did this but somehow never committed the code nor created a PR...
Thanks :)