mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 16:43:55 +00:00
Merge pull request #1532 from clarkdo/dev
match correct route when resolveComponents in hash mode
This commit is contained in:
commit
26ee7cb241
@ -134,7 +134,7 @@ async function loadAsyncComponents (to, from, next) {
|
|||||||
|
|
||||||
// Get matched components
|
// Get matched components
|
||||||
function resolveComponents(router) {
|
function resolveComponents(router) {
|
||||||
const path = getLocation(router.options.base)
|
const path = getLocation(router.options.base, router.options.mode)
|
||||||
|
|
||||||
return flatMapComponents(router.match(path), (Component, _, match, key, index) => {
|
return flatMapComponents(router.match(path), (Component, _, match, key, index) => {
|
||||||
// If component already resolved
|
// If component already resolved
|
||||||
|
@ -144,8 +144,11 @@ export function promisify (fn, context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Imported from vue-router
|
// Imported from vue-router
|
||||||
export function getLocation (base) {
|
export function getLocation (base, mode) {
|
||||||
var path = window.location.pathname
|
var path = window.location.pathname
|
||||||
|
if (mode === 'hash') {
|
||||||
|
return window.location.hash.replace(/^#\//, '')
|
||||||
|
}
|
||||||
if (base && path.indexOf(base) === 0) {
|
if (base && path.indexOf(base) === 0) {
|
||||||
path = path.slice(base.length)
|
path = path.slice(base.length)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user