mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 16:12:12 +00:00
fix: Handle redirects for loading bar
This commit is contained in:
parent
28d3e6fdb3
commit
e33d502696
@ -197,9 +197,11 @@ async function render (to, from, next) {
|
|||||||
// nextCalled is true when redirected
|
// nextCalled is true when redirected
|
||||||
let nextCalled = false
|
let nextCalled = false
|
||||||
const _next = path => {
|
const _next = path => {
|
||||||
<% if(loading) { %>if(this.$loading.finish) this.$loading.finish()<% } %>
|
<% if(loading) { %>if (from.path === path.path && this.$loading.finish) this.$loading.finish()<% } %>
|
||||||
|
<% if(loading) { %>if (from.path !== path.path && this.$loading.pause) this.$loading.pause()<% } %>
|
||||||
if (nextCalled) return
|
if (nextCalled) return
|
||||||
nextCalled = true
|
nextCalled = true
|
||||||
|
_lastPaths = getMatchedComponents(from).map((Component, i) => compile(from.matched[i].path)(from.params))
|
||||||
next(path)
|
next(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,12 +329,12 @@ async function render (to, from, next) {
|
|||||||
return Promise.all(promises)
|
return Promise.all(promises)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
_lastPaths = Components.map((Component, i) => compile(to.matched[i].path)(to.params))
|
|
||||||
|
|
||||||
<% if(loading) { %>if(this.$loading.finish) this.$loading.finish()<% } %>
|
|
||||||
|
|
||||||
// If not redirected
|
// If not redirected
|
||||||
if (!nextCalled) next()
|
if (!nextCalled) {
|
||||||
|
<% if (loading) { %>if(this.$loading.finish) this.$loading.finish()<% } %>
|
||||||
|
_lastPaths = Components.map((Component, i) => compile(to.matched[i].path)(to.params))
|
||||||
|
next()
|
||||||
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (!error) error = {}
|
if (!error) error = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user