mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +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
|
||||
let nextCalled = false
|
||||
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
|
||||
nextCalled = true
|
||||
_lastPaths = getMatchedComponents(from).map((Component, i) => compile(from.matched[i].path)(from.params))
|
||||
next(path)
|
||||
}
|
||||
|
||||
@ -327,12 +329,12 @@ async function render (to, from, next) {
|
||||
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 (!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) {
|
||||
if (!error) error = {}
|
||||
|
Loading…
Reference in New Issue
Block a user